JSPM

get-data-type

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q22370F
  • License MIT

Get data's type

Package Exports

  • get-data-type

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (get-data-type) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

get-data-type

Get data's type

how to use get-data-type

npm install --save data-type
const dataType = require('get-data-type');

dataType('test'); // return 'string'

test

const assert = require('assert');
const m = require('./');

assert(m(null) === 'null', 'should return null');
assert(m(undefined) === 'undefined', 'should return undefined');
assert(m(true) === 'boolean', 'should return boolean');
assert(m(false) === 'boolean', 'should return boolean');
assert(m(1) === 'number', 'should return number');
assert(m('test') === 'string', 'should return string');
assert(m(Symbol()) === 'symbol', 'should return symbol');
assert(m({}) === 'object', 'should return object');
assert(m([]) === 'array', 'should return array');
assert(m(()=>{}) === 'function', 'should return function');
assert(m(new Date()) === 'date', 'should return date');
assert(m(new RegExp()) === 'regexp', 'should return regexp');