Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
A simple, basic, and robust set of utilities for javascript - inspired by, but not copied from, lodash.
$ npm i -S isdo
const { is } = require('isdo');
let foo;
is.defined(foo); // => false
is.missing(foo); // => true
foo = null;
is.defined(foo) // => true
is.missing(foo) // => true
const arry = [];
is.array(arry); // => true
is.empty(arry); // => true
arry.push(1);
is.empty(arry); // => false
You can add your own useful comparisons and checks by using is.extend.
type comparisons
presence checks
quality checks
truthy/falsey checks
extending with custom methods
presence checks
truthy/falsey checks
presence checks
truthy/falsey checks
is.array(target)
Returns
true
if target is an array, otherwise false
.
is.boolean(target)
Returns
true
if target is a boolean, otherwise false
.
is.float(target)
Returns
true
if target is a float, otherwise false
.
is.function(target)
Returns
true
if target is a function, otherwise false
.
is.integer(target)
Returns
true
if target is an integer, otherwise false
.
is.iterable(target)
Returns
true
if target conforms to the iterable protocol, otherwise false
.
is.map(target)
Returns
true
if target is a map, otherwise false
.
is.number(target)
Returns
true
if target is a number (integer or float), otherwise false
.
is.object(target)
Returns
true
if target is a plain object, otherwise false
.
is.set(target)
Returns
true
if target is a set, otherwise false
.
is.string(target)
Returns
true
if target is a string, otherwise false
.
is.defined(target)
Returns
true
if target is NOT undefined, otherwise false
.
is.missing(target)
Returns
true
if target is either undefined or null, otherwise false
.
is.notNull(target)
Returns
true
if target is anything other than null, even undefined, otherwise false
.
is.present(target)
Returns
true
if target is both defined and not null, otherwise false
.
is.blank(target)
Returns
true
if target string is missing or has length < 1, otherwise false
.
is.empty(target)
Returns
true
if target's length < 1, otherwise false
.
If target is an array or string, length = target.length, if target is a map or set, length = target.size, if target is an object, length = number of keys in target, otherwise length = 0.
is.true(target)
Returns
true
if target is a string and is one of ["t", "true", "1"]
, or if target is a number and is > 0, or if target is a boolean and is true
, otherwise returns false
.
Ignores capitalization.
is.false(target)
Returns
true
if target is a string and is one of ["f", "false", "0"]
, or if target is a number and is <= 0, or if target is a boolean and is false
, otherwise returns false
.
Ignores capitalization.
is.extend(source)
Transfers functions and nested functions from source to is
.
Example
const moment = require('moment');
const isdo = require('is');
const is = isdo.is.extend({
date: obj => moment.isDate(obj),
});
is.date('foo'); // => false
is.date(new Date()); // => true
is.all.defined(targets)
Returns
true
if all targets are defined, otherwise false
.
is.all.undefined(targets)
Returns
true
if all targets are undefined, otherwise false
.
is.all.present(targets)
Returns
true
if all targets are neither null nor undefined, otherwise false
.
is.all.missing(targets)
Returns
true
if all targets are null or undefined, otherwise false
.
is.all.true(targets)
Returns
true
if all targets are truthy, otherwise false
.
is.all.false(targets)
Returns
true
if all targets are falsey, otherwise false
.
is.any.defined(targets)
Returns
true
if at least one of targets are defined, otherwise false
.
is.any.undefined(targets)
Returns
true
if at least one of targets are undefined, otherwise false
.
is.any.present(targets)
Returns
true
if at least one of targets are neither null nor undefined, otherwise false
.
is.any.missing(targets)
Returns
true
if at least one of targets are null or undefined, otherwise false
.
is.any.true(targets)
Returns
true
if at least one of targets are truthy, otherwise false
.
is.any.false(targets)
Returns
true
if at least one of targets are falsey, otherwise false
.
is
module for common comparisons and checks i/e undefined, null, object, etcdo
module for common functions i/e merge, get, etcFAQs
Simple, basic, but robust javascript utilities.
We found that isdo 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.