is-or-not
v1.0.4
Published
A Set of `is` and `isNot` functions in JavaScript checking and testing on objects and types
Downloads
10
Maintainers
Readme
IsOrNot
Description
A Set of is
and isNot
functions in JavaScript checking and testing on objects and types
Install
$ yarn add is-or-not
or
$ npm install is-or-not
Usage
const utils = require("is-or-not");
utils.isNull(null); // type is null => true
utils.isNull(undefined); // type is undefined => false
utils.isNotNull(undefined); // correct it's undefined=> true
utils.isNotEmpty(["🦄", "🐶", "🐼"]); // array contain values => false
utils.isNotEmpty([]); // array is empty => false
/** ... */
utils.isString("Hello World!"); // Type is String => true
utils.isNotString(["🐶", "🦄"]); // true because type is array => true
/** ... */
utils.isPrimitive("Primitive type?"); // String is a Primitive type => true
utils.isNotPrimitive("Not primitive type?"); // False because it's a string, primitive => false
/** ... */
utils.isNullOrUndefined("Hello!"); // String is not null or undefined => false
utils.isNullOrUndefined(undefined); // => true
utils.isNotNullOrUndefined("Not primitive type?"); // true it's a string => true
utils.isNotNullOrUndefined(null); // it is null => false
.
.
.
Documentation
- isArray
- isBoolean
- isDate
- isEmpty
- isError
- isFunction
- isNotArray
- isNotBoolean
- isNotDate
- isNotEmpty
- isNotError
- isNotFunction
- isNotNull
- isNotNullOrUndefined
- isNotNumber
- isNotObject
- isNotPrimitive
- isNotRegExp
- isNotString
- isNotSymbol
- isNotUndefined
- isNull
- isNullOrUndefined
- isNumber
- isObject
- isPrimitive
- isRegExp
- isString
- isSymbol
- isUndefined
Contribution
Clone the Github Repository
$ git clone [email protected]:AlaeddineMessadi/utils-is.git
All functions' implementations are in the index.js
file.
Tests are defined in the test.js
file
Running tests
$ yarn test
// or
$ yarn test:watch
or with npm
$ npm run test
or
$ npm run test:watch