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.
🔩 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
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
📑 Related links :
- v_to_md5 ⏭ MD5 hash generator
- v_to_sha256 ⏭ sha256 hash generator
- v_file_system ⏭ simple and safe fs module with sync and promises
- v_execute ⏭ Exec cli commands
- v_scrolls ⏭ Readme Generator
- v_database ⏭ single database solution
- v_database_cli ⏭ v_database cli tool