Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
core-util-is
Advanced tools
The `util.is*` functions introduced in Node v0.12.
Weekly downloads
Package description
The core-util-is package provides utility functions for checking the types of JavaScript values, similar to the 'util.is*' functions that were available in Node.js but have since been deprecated. It allows developers to accurately determine the type of a variable, which can be particularly useful when dealing with APIs that may return data of various types or when validating input.
isArray
Checks if a value is an Array.
var is = require('core-util-is');
var result = is.isArray([1, 2, 3]); // result will be true
isBoolean
Checks if a value is a Boolean.
var is = require('core-util-is');
var result = is.isBoolean(false); // result will be true
isNull
Checks if a value is null.
var is = require('core-util-is');
var result = is.isNull(null); // result will be true
isNullOrUndefined
Checks if a value is null or undefined.
var is = require('core-util-is');
var result = is.isNullOrUndefined(null); // result will be true
isNumber
Checks if a value is a Number.
var is = require('core-util-is');
var result = is.isNumber(42); // result will be true
isString
Checks if a value is a String.
var is = require('core-util-is');
var result = is.isString('node'); // result will be true
isSymbol
Checks if a value is a Symbol.
var is = require('core-util-is');
var result = is.isSymbol(Symbol('foo')); // result will be true
isUndefined
Checks if a value is undefined.
var is = require('core-util-is');
var result = is.isUndefined(undefined); // result will be true
isObject
Checks if a value is an Object.
var is = require('core-util-is');
var result = is.isObject({}); // result will be true
isFunction
Checks if a value is a Function.
var is = require('core-util-is');
var result = is.isFunction(function() {}); // result will be true
isPrimitive
Checks if a value is a primitive (not an Object).
var is = require('core-util-is');
var result = is.isPrimitive('string'); // result will be true
isBuffer
Checks if a value is a Buffer object.
var is = require('core-util-is');
var result = is.isBuffer(Buffer.from('node')); // result will be true
Lodash is a comprehensive utility library that provides a wide range of functions for manipulating and checking data types, among many other utilities. It offers similar type-checking functions like _.isArray, _.isBoolean, etc., and is more extensive than core-util-is.
Kind-of is a simple utility for checking the type of a value. It is similar to core-util-is but provides a single function that returns the type as a string, rather than multiple functions for each type.
The 'is' package offers a set of type check functions for JavaScript, which can be used both in Node.js and in the browser. It is similar to core-util-is but also includes additional checks for types like 'is.integer' or 'is.float'.
Readme
The util.is*
functions introduced in Node v0.12.
FAQs
The `util.is*` functions introduced in Node v0.12.
The npm package core-util-is receives a total of 35,358,977 weekly downloads. As such, core-util-is popularity was classified as popular.
We found that core-util-is 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
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.