AlaeddineMessadi / is-or-not

A Set of `is` functions in JavaScript for checking on objects and types

Home Page:https://alaeddinemessadi.github.io/is-or-not/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

IsOrNot

Build Status

Description

github

documentation

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 => true
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

documentation

Contribution

Clone the Github Repository

$ git clone git@github.com: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

About

A Set of `is` functions in JavaScript for checking on objects and types

https://alaeddinemessadi.github.io/is-or-not/index.html

License:MIT License


Languages

Language:JavaScript 100.0%