JSPM

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

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

Package Exports

    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

    npm install v_is_empty_value

    🎭 And save for later re-install

    npm install v_is_empty_value --save

    🪁 How to use

    const { isEmpty, notEmpty, isEmptySync, notEmptySync } = require("v_is_empty_value");

    or you can import...

    import v_is_empty_value from 'v_is_empty_value';
    const { isEmpty, notEmpty, isEmptySync, notEmptySync } = v_is_empty_value;

    ☑ Things it confirms Empty

    // Empty
    await isEmpty()  //-> TRUE
    isEmptySync()  //-> TRUE
    
    await notEmpty()  //-> FALSE
    notEmptySync()  //-> FALSE
    
    // Empty String
    await isEmpty("")  //-> TRUE
    isEmptySync("")  //-> TRUE
    
    await notEmpty("")  //-> FALSE
    notEmptySync("")  //-> FALSE
    
    // Null
    await isEmpty(null)  //-> TRUE
    isEmptySync(null)  //-> TRUE
    
    await notEmpty(null)  //-> FALSE
    notEmptySync(null)  //-> FALSE
    
    // Undefined
    await isEmpty(undefined)  //-> TRUE
    isEmptySync(undefined)  //-> TRUE
    
    await notEmpty(undefined)  //-> FALSE
    notEmptySync(undefined)  //-> FALSE
    
    // NaN
    await isEmpty(NaN)  //-> TRUE
    isEmptySync(NaN)  //-> TRUE
    
    await notEmpty(NaN)  //-> FALSE
    notEmptySync(NaN)  //-> FALSE
    
    // Object
    await isEmpty({})  //-> TRUE
    isEmptySync({})  //-> TRUE
    
    await notEmpty({})  //-> FALSE
    notEmptySync({})  //-> FALSE
    
    // Array
    await isEmpty([])  //-> TRUE
    isEmptySync([])  //-> TRUE
    
    await notEmpty([])  //-> FALSE
    notEmptySync([])  //-> FALSE

    ☑ Few things it confirms NOT Empty

    await isEmpty("demo_password_123456")  //-> FALSE
    await notEmpty("demo_password_123456")  //-> TRUE
    
    await isEmpty(new Date())  //-> FALSE
    await notEmpty(new Date())  //-> TRUE
    
    await isEmpty(new Error())  //-> FALSE
    await notEmpty(new Error())  //-> TRUE
    
    await isEmpty(new Promise((resolve, reject) => resolve(true)))  //-> FALSE
    await notEmpty(new Promise((resolve, reject) => resolve(true)))  //-> TRUE

    🚀 Benchmarking

    Performance depends on whether you're using asynchronous or synchronous version. Sync versions tend to run slower. Currently asynchronous version achieves up to 20k checks per millisecond, while sync version does up to 8k checks per ms.

    NOTE: This version improves only performance of the code and cuts down on execution time, thus resulting in such performance uplift without changing/breaking any test cases.

    ✅ Test Results and Coverage with Jest

    v_is_empty_value Node Module Test and Coverage with Jest

    📑 Related links :