Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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 46,814,543 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.