Skip to content

Checking whether value is undefined or null or object empty

Notifications You must be signed in to change notification settings

Workaja/validation-checking

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#validation-checking

A validation checking library

npm version coverage js-standard-style

Note: This is module will work in both client side and server side

Installing

npm i validation-checking

Dependencies

No dependencies

Usage

Object, undefined and null validation

    const ValidationChecking = require('validation-checking')

    ValidationChecking.isObjectEmpty({}) // true
    ValidationChecking.isObjectEmpty({ a: 1 }) //false

    ValidationChecking.isObjectUndefinedOrNullOrEmpty(null) // true
    ValidationChecking.isObjectUndefinedOrNullOrEmpty({ a: 1 }) // false

    ValidationChecking.isUndefinedOrNull(null) // true
    ValidationChecking.isUndefinedOrNull('testString') // false

    ValidationChecking.isUndefined(undefined) // true
    ValidationChecking.isUndefined('testString') // false

    ValidationChecking.isNull(null) // true
    ValidationChecking.isNull('testString') // false

Data types validation

    const ValidationChecking = require('validation-checking')

    // number
    ValidationChecking.isNumber(5) // true
    ValidationChecking.isNumber('testString') // false

    // boolean
    ValidationChecking.isBoolean(false) // true
    ValidationChecking.isBoolean('testString') // false

    // string
    ValidationChecking.isString('testString') // true
    ValidationChecking.isString(5) // false

    // array
    ValidationChecking.isArray([1, 2]) // true
    ValidationChecking.isArray('testString') // false

    // object
    ValidationChecking.isObject({ testKey: 'testValue' }) // true
    ValidationChecking.isObject('testString') // false

About

Checking whether value is undefined or null or object empty

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%