Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
is-type-of
Advanced tools
Changelog
Readme
Complete type checking for Node
npm install is-type-of
Use ES Module import
import is from 'is-type-of';
import { isArray } from 'is-type-of';
isArray([]); // => true
is.array(); // => true
Compatible With
const is = require('is-type-of');
is.array([1]); // => true
is.primitive(true); // => true
is.primitive({}); // => false
is.generatorFunction(function * () {}); // => true
is.long(Math.pow(2, 33)); // => true
is.double(0); // => false
Use Type Guard
import { isArray } from 'is-type-of';
function checkArray(arr: string[] | string) {
// => parameter) arr: string | string[]
if (isArray(arr)) {
// => (parameter) arr: string[]
arr.forEach(console.log);
}
}
Returns true if val
is string, not String
object.
See Also is.string
Returns true if val
is number, not Number
object.
See Also is.number
Returns true if val
is boolean, not Boolean
object.
See Also is.boolean
Returns true if val
is bigint.
See Also is.bigInt
Returns true if val
is symbol.
See Also is.symbol
Returns true if val
is undefined.
See Also is.undefined
Returns true if val
is null.
See Also is.null
Returns true if val
is null or undefined.
See Also is.nullable
Returns true if val
is primitive.
See Also is.primitive
Returns true if val
is integer.
See Also is.integer
Returns true if val
is integer, and between -2 ** 31
and 2 ** 31 - 1
.
See Also is.integer32
Returns true if val
is integer, and < -2 ** 31
, and > 2 ** 31 - 1
.
See Also is.long
Returns true if val
is integer, and between -(2 ** 53 - 1)
and 2 ** 53 - 1
.
See Also is.safeInteger
Returns true if val
is Double.
See Also is.double
Returns true if val
is NaN.
See Also is.NaN
Returns true if val
is finite.
See Also is.finite
Returns true if val
is array, it won't check items of array.
See Also is.array
Returns true if val
is function.
See Also is.function
Returns true if val
is generator function.
See Also is.generatorFunction
Returns true if val
is async function.
See Also is.asyncFunction
Returns true if val
is async generator function.
See Also is.asyncGeneratorFunction
Returns true if val
is object.
See Also is.object
Returns true if val
is class.
Note: "class" is supported in ECMAScript 6, and if the code is using some compiler or transpiler, the checking might fail.
See Also is.class
Returns true if val
is regular expression.
See Also is.regExp
Returns true if val
is instance of Date.
See Also is.date
Returns true if val
is instance of Error.
See Also is.error
Returns true if val
is generator.
See Also is.generator
Returns true if val
is promise.
See Also is.promise
Returns true if val
is like promise, if the object has then
property, the checking will pass.
See Also is.promiseLike
Returns true if val
is buffer.
See Also is.buffer
Returns true if val
is stream.
See Also is.stream
Returns true if val
is readable stream.
See Also is.readable
Returns true if val
is write stream.
See Also is.writable
Returns true if val
is duplex stream.
See Also is.duplex
returns true if val is LongObject
LongObject is from npm package long
See Also is.longObject
MIT
FAQs
complete type checking for node
The npm package is-type-of receives a total of 229,798 weekly downloads. As such, is-type-of popularity was classified as popular.
We found that is-type-of demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.