
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
npm i data-type --save
<script type="text/javascript" src="/type.js"></script>
var DataType = require('data-type')
// get type
DataType.type(1) // number
DataType.type("") // string
DataType.type(true) // boolean
DataType.type(undefined) // undefined
DataType.type(null) // null
DataType.type([]) // array
DataType.type({}) // object
DataType.type(function () {}) // function
DataType.type(Symbol()) // symbol
DataType.type(new Promise(function (resolve, reject) {})) // promise
DataType.type(new Error()) // error
DataType.type(new RegExp()) // regexp
// is type
DataType.isNumber(1) // true
DataType.isNumber(new Number(0)) // true
DataType.isString("") // true
DataType.isString(new String()) // true
DataType.isBoolean(true) // true
DataType.isUndefined(undefined) // true
DataType.isNull(null) // true
DataType.isArray([]) // true
DataType.isArray(new Array()) // true
DataType.isPlainObject({}) // true
DataType.isPlainObject(Object.create({})) // true
DataType.isFunction(function () {}) // true
DataType.isPlainFunction(function () {}) // true
DataType.isGeneratorFunction(function* () {}) // true
DataType.isPlainFunction(function* () {}) // false
DataType.isGeneratorFunction(function () {}) // false
DataType.isSymbol(Symbol()) // true
DataType.isPromise(new Promise(function (resolve, reject) {})) // true
DataType.isError(new Error()) // true
DataType.isRegExp(/^.*$/) // true
| key | description | params | return |
|---|---|---|---|
| type | get type | data | string |
| isNumber | is number | data | true,false |
| isString | is string | data | true,false |
| isBoolean | is boolean | data | true,false |
| isUndefined | is undefined | data | true,false |
| isNull | is null | data | true, false |
| isArray | is array | data | true, false |
| isFunction | is function | data | true,false |
| isGeneratorFunction | is generator function | data | true,false |
| isPlainFunction | is plain function | data | true,false |
| isPlainObject | is plain object | data | true,false |
| isSymbol | is symbol | data | true,false |
| isPromise | is promise | data | true,false |
| isError | is error | data | true,false |
| isRegExp | is regexp | data | true,false |
npm test
data-type is released under the MIT license.
FAQs
check your data type
We found that data-type demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.