condition-module

1.0.0 • Public • Published

feature

  • check array is null or not
  • check object is null or not
  • undefined, NaN, null will be retrun false
  • infinity will be return true

example

const { condition } = require("condition-module")

const data = []
condition(data, (data) => {
  // this will not run
}).catch(err => {
  // this will be run
  console.log(err); // this 'boolean' is not true
})

how to use

installation

npm install condition-module --save

basic

const { condition } = require("condition-module")
condition(true) // return true
condition([]) // return false

using callback

const { condition } = require("condition-module")

condition(true, (data) => {
  // this run if condition true
  console.log(`${data} is true`);
}).catch(err => {
  // do if condition false
  console.log(err); // this 'boolean' is not true
})

Readme

Keywords

Package Sidebar

Install

npm i condition-module

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

2.75 kB

Total Files

4

Last publish

Collaborators

  • fiandev