Skip to content

module that can be used to compare value of variabel

Notifications You must be signed in to change notification settings

fiandev/condition-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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

About

module that can be used to compare value of variabel

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published