JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q36909F
  • License MIT

Simple checker functions for empty values. Can check if a value is empty or not. [ isEmpty(val) / isNotEmpty(val) ]

Package Exports

  • v_is_empty_value
  • v_is_empty_value/dist/v_is_empty_value.cjs.js
  • v_is_empty_value/dist/v_is_empty_value.es.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (v_is_empty_value) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

👨‍💻 v_is_empty_value

Simple checker for Empty/NotEmpty values. Checking Numbers, Null, NaN, Strings, Objects, Arrays...Will also detect instance of Date() object and return "not-empty" value for it.

Codacy Badge CodeQL njsscan sarif

🔩 Install using command & save for later

    npm install v_is_empty_value --save

🪁 How to use

    const { isEmpty, isNotEmpty, isEmptyNested, isNotEmptyNested } = require("v_is_empty_value")

or you can import...

    import v_is_empty_value from 'v_is_empty_value'
    const { isEmpty, isNotEmpty, isEmptyNested, isNotEmptyNested } = v_is_empty_value

List

    // Checks if a value is empty. Returns true if the value is empty, else false.
    isEmpty(v) 

    // Checks if a value is not empty. Returns true if the value is not empty, else false.
    isNotEmpty(v)

    // Checks if a nested value is empty. Returns true if the nested value is empty, else false.
    isEmptyNested(v)

    // Checks if a nested value is not empty. Returns true if the nested value is not empty, else false.
    isNotEmptyNested(v)

☑ Things it confirms Empty

// Empty
isEmpty()  //-> TRUE
isNotEmpty()  //-> FALSE

// Empty String
isEmpty("")  //-> TRUE
isNotEmpty("")  //-> FALSE

// Null
isEmpty(null)  //-> TRUE
isNotEmpty(null)  //-> FALSE

// Undefined
isEmpty(undefined)  //-> TRUE
isNotEmpty(undefined)  //-> FALSE

// NaN
isEmpty(NaN)  //-> TRUE
isNotEmpty(NaN)  //-> FALSE

// Object
isEmpty({})  //-> TRUE
isNotEmpty({})  //-> FALSE

// Array
isEmpty([])  //-> TRUE
isNotEmpty([])  //-> FALSE

☑ Few things it confirms NOT Empty

 isEmpty("demo_password_123456")  //-> FALSE
 isNotEmpty("demo_password_123456")  //-> TRUE

 isEmpty(new Date())  //-> FALSE
 isNotEmpty(new Date())  //-> TRUE

 isEmpty(new Error())  //-> FALSE
 isNotEmpty(new Error())  //-> TRUE

 isEmpty(new Promise((resolve, reject) => resolve(true)))  //-> FALSE
 isNotEmpty(new Promise((resolve, reject) => resolve(true)))  //-> TRUE

🚀 Benchmarking

Current performance:

isEmpty(v)
~ 40,000 ops/ms [ 40 mil. ops/sec ]

isNotEmpty(v)
~ 28,000 ops/ms [ 28 mil. ops/sec ]

isEmptyNested(v)
~ 29,000 ops/ms [ 29 mil. ops/sec ]

isNotEmptyNested(v)
~ 29,000 ops/ms [ 29 mil. ops/sec ]


✅ Test Results and Coverage with Jest

v_is_empty_value Node Module Test and Coverage with Jest

📑 Related links :