
Security News
Cline CLI npm Package Compromised via Suspected Cache Poisoning Attack
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.
@ncardez/is
Advanced tools
A data type checker and validator for node (typescript compatible).
is.jwt.As a node.js module
$ npm install @ncardez/is
const is = require('@ncardez/is');
npm run test
is.object (value: object) :boolean // Example:
expect(is.object({})).toBe(true);
is.null (value: null) :boolean // Example:
expect(is.null(null)).toBe(true);
is.undefined (value: undefined): boolean // Example:
expect(is.undefined()).toBe(true);
expect(is.undefined(undefined)).toBe(true);
is.number (value: number|string, parse: boolean): boolean // Example:
expect(is.number(12)).toBe(true);
expect(is.number(-23)).toBe(true);
expect(is.number('13', true)).toBe(true);
is.array (value: array): boolean // Example:
expect(is.array([])).toBe(true);
is.string (value: string): boolean // Example:
expect(is.string('')).toBe(true);
is.boolean (value: boolean|string, parse: boolean): boolean // Example:
expect(is.boolean(true)).toBe(true);
expect(is.boolean(false)).toBe(true);
expect(is.boolean('true', true)).toBe(true);
expect(is.boolean('false', true)).toBe(true);
is.uuid (value: string, version: string): boolean
value: must be a valid UUID.
version: 'v1'|'v2'|'v3'|'v4'|'v5'
// Example:
expect(is.uuid('1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed', 'v4')).toBe(true);
is.integer (value: number|string): boolean// Example:
expect(is.integer(23)).toBe(true);
expect(is.integer('43')).toBe(true);
is.float (value: number|string): boolean// Example:
expect(is.float(.23)).toBe(true);
expect(is.float('2.43')).toBe(true);
is.positive (value: number|string, parse: boolean): boolean// Example:
expect(is.positive(23)).toBe(true);
expect(is.positive('2.43')).toBe(true);
is.negative (value: number|string, parse: boolean): boolean// Example:
expect(is.negative(-23)).toBe(true);
expect(is.negative('-2.43')).toBe(true);
is.zero (value: number|string, parse: boolean): boolean// Example:
expect(is.zero(0)).toBe(true);
expect(is.zero('0')).toBe(true);
is.between (min: number|string|date, max: number|string|date, value: number|string|date, parse: boolean): boolean// Example:
expect(is.between(0, 10, 5)).toBe(true);
expect(is.between('0', '6', '2')).toBe(true);
expect(is.between('2010-02-01', '2010-02-20', '2010-02-10')).toBe(true);
expect(is.between(new Date('2010-02-01'), new Date('2010-02-20'), new Date('2010-02-10'))).toBe(true);
is.alpha (value: string): boolean// Example:
expect(is.zero('aknd23')).toBe(true);
expect(is.zero('0ksjdn =13')).toBe(false);
is.digit (value: number|string): boolean// Example
expect(is.zero('2')).toBe(true);
expect(is.zero(3)).toBe(true);
is.function (value: function): boolean// Example:
expect(is.function(() => {})).toBe(true);
expect(is.function(function() {})).toBe(true);
is.asyncFunction (value: Async Function): boolean// Example:
expect(is.asyncFunction(async () => {})).toBe(true);
expect(is.asyncFunction(async function() {})).toBe(true);
is.promise (value: Promise): boolean// Example:
expect(is.promise(Promise.resolve(2))).toBe(true);
is.empty (value: string|array|object|function): boolean// Example:
expect(is.promise('')).toBe(true);
expect(is.promise([])).toBe(true);
expect(is.promise({})).toBe(true);
expect(is.promise(() => {})).toBe(true);
expect(is.promise(function () {})).toBe(true);
is.regexp (value: RegExp): boolean// Example:
expect(is.regexp(/\d/)).toBe(true);
is.ip (value: string): boolean// Example:
expect(is.ip('192.168.0.1')).toBe(true);
is.port (value: number): boolean// Example:
expect(is.port(8080)).toBe(true);
is.date (value: string): boolean// Example:
expect(is.date('2010-02-03')).toBe(true);
is.time (value: string): boolean// Example:
expect(is.time('03:20:14')).toBe(true);
is.dateTime (value: string): boolean// Example:
expect(is.dateTime('2010-02-03 03:20:14')).toBe(true);
is.dateISO (value: string): boolean// Example:
expect(is.dateISO('2010-02-03 03:20:14.290z')).toBe(true);
expect(is.dateISO('2010-02-03 03:20:14')).toBe(true);
expect(is.dateISO('2010-02-03T03:20:14')).toBe(true);
expect(is.dateISO('2010-02-03 03:20:14.290Z')).toBe(true);
expect(is.dateISO('2018-02-11T02:10:14.210Z')).toBe(true);
is.dateInstance (value: Date): boolean// Example:
expect(is.dateInstance(new Date())).toBe(true);
expect(is.dateInstance(new Date('2018-02-11T02:10:14.210Z'))).toBe(true);
is.dateValid (value: Date): boolean// Example:
expect(is.dateValid('2010-02-03')).toBe(true);
expect(is.dateValid('2010-02-03 11:11:11')).toBe(true);
expect(is.dateValid('2010-02-03 11:11:11.000Z')).toBe(true);
expect(is.dateValid('2010-02-03T11:11:11.000Z')).toBe(true);
expect(is.dateValid(new Date())).toBe(true);
expect(is.dateValid(new Date(2020, 10, 12))).toBe(true);
expect(is.dateValid(new Date('2010-02-03'))).toBe(true);
is.type (value: function|number|boolean|object|array|null|undefined|regexp|date|string|function, parse: boolean): string// Example:
expect(is.type).toBeFunction();
expect(is.type(3)).toEqual('number');
expect(is.type(true)).toEqual('boolean');
expect(is.type({})).toEqual('object');
expect(is.type([])).toEqual('array');
expect(is.type(null)).toEqual('null');
expect(is.type()).toEqual('undefined');
expect(is.type(undefined)).toEqual('undefined');
expect(is.type(/\d/)).toEqual('regexp');
expect(is.type(new Date())).toEqual('date');
expect(is.type('djsnfkjsndfkjn')).toEqual('string');
expect(is.type(function(){})).toEqual('function');
expect(is.type(() => {})).toEqual('function');
is.error (value: Error): boolean// Example:
expect(is.error(new Error('Ouch!'))).toBe(true);
expect(is.error({ stack: 'aa', message: 'sss' })).toBe(true);
is.jwt (value: string): booleanis.jsonwebtoken (value: string): boolean// Example:
const token: string = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9' +
'.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ' +
'.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c';
expect(is.jwt(token)).toBe(true);
expect(is.jsonwebtoken(token)).toBe(true);
© Norman Carcamo, Software Developer
Licensed under the MIT.
FAQs
Data type checker
The npm package @ncardez/is receives a total of 8 weekly downloads. As such, @ncardez/is popularity was classified as not popular.
We found that @ncardez/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
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.

Product
Socket now supports PHP with full Composer and Packagist integration, enabling developers to search packages, generate SBOMs, and protect their PHP dependencies from supply chain threats.