Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
core-util-is
Advanced tools
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'.
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 22,041,160 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
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.