1.0.0 • Published 2 years ago

condition-module v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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
})