Giter Site home page Giter Site logo

grjan7 / get-dtype-of Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 26 KB

An utility npm package to return data type.

License: GNU General Public License v3.0

JavaScript 100.00%
array datatypes javascript nodejs objects string typeof npm npm-package

get-dtype-of's Introduction

get-dtype-of

NPM version NPM downloads Known Vulnerabilities

Description

This package returns the type of input. By default, the returned data type can be a string | number | boolean | array | object | null | undefined | function. Setting refineObject to true returns the refined type of object (e.g., Date, Map, Set, Buffer, EventEmitter).

Installation

  npm i get-dtype-of

Usage

getTypeOf(input, refineObject)

  • input | any
  • refineObject | boolean | default: false

Examples

  const getTypeOf = require('get-dtype-of');
Without Option Returns With Option (refineObject: true) Returns
getTypeOf("Hello") string getTypeOf("Hello", true) string
getTypeOf(412) number getTypeOf(412, true) number
getTypeOf(true) boolean getTypeOf(true, true) boolean
getTypeOf(undefined) undefined getTypeOf(undefined, true) undefined
getTypeOf(["a", "b"]) array getTypeOf(["a", "b"], true) array
getTypeOf(null) null getTypeOf(null, true) null
getTypeOf(stream) function getTypeOf(stream, true) function
getTypeOf({ name: "John" }) object getTypeOf({ name: "John" }, true) object
getTypeOf(/[a-z]/) object getTypeOf(/[a-z]/, true) RegExp
getTypeOf(new Date()) object getTypeOf(new Date(), true) Date
getTypeOf(new Set()) object getTypeOf(new Set(), true) Set

get-dtype-of's People

Contributors

grjan7 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.