@fiquu/is

3.0.2 • Public • Published

@fiquu/is

Build Status GitHub GitHub last commit npm (scoped) npm

Functional, dependency-free check library for Node.js and the browser (transpiled).

Installation

npm i @fiquu/is

Usage

Import by category:

import { isString, isNumber } from '@fiquu/is/type';
import { isIntlPhone } from '@fiquu/is/regexp';

isString('foo'); // true
isString(2); // false

isNumber(1); // true
isNumber('1'); // false

intlPhone('+12015556677'); // true
intlPhone('1234'); // false

Or just what you need:

import { isIntlPhone } from '@fiquu/is/regexp/intl-phone';
import { isString } from '@fiquu/is/type/string';
import { isNumber } from '@fiquu/is/type/number';

isString('foo'); // true
isSstring(2); // false

isNumber(1); // true
isNumber('1'); // false

isIntlPhone('+12015556677'); // true
isIntlPhone('1234'); // false

Multiple Values

If you need to check multiple values, then use the some and every array methods:

import { isString, isNumber } from '@fiquu/is/type';

['foo', 'bar'].every(isString); // true
[1, 2, 'baz'].every(isString); // false

[1, 2, 3, 4].every(isNumber); // true
[1, 2, 'foo'].every(isNumber); // false

['foo', 'bar', true].some(isString); // true
[1, 2, 'baz'].some(isString); // false

[1, null, '3'].some(isNumber); // true
[false, null, 'foo'].some(isNumber); // false

Documentation

Please see the documentation page for more details.

Package Sidebar

Install

npm i @fiquu/is

Weekly Downloads

0

Version

3.0.2

License

MIT

Unpacked Size

112 kB

Total Files

193

Last publish

Collaborators

  • stgogm