Package Exports
- is-empty-data
- is-empty-data/index.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 (is-empty-data) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
is-empty-data
Tiny utility to check if a value is empty (null, undefined, '', [], {}, NaN, empty Map/Set).
Install
npm install is-empty-dataUsage
const isEmptyValue = require('./index');
isEmptyValue(null); // true
isEmptyValue(undefined); // true
isEmptyValue(''); // true
isEmptyValue(' '); // true
isEmptyValue([]); // true
isEmptyValue({}); // true
isEmptyValue(NaN); // true
isEmptyValue(new Map()); // true
isEmptyValue(new Set()); // true
isEmptyValue(42); // false
isEmptyValue('hello'); // false
isEmptyValue([1, 2]); // false
isEmptyValue({ a: 1 }); // false
isEmptyValue(new Map([['a', 1]])); // false
isEmptyValue(new Set([1])); // falseAPI
isEmptyValue(value)
Returns true if the value is considered empty:
nullorundefined- Empty string (after trim)
- Empty array
- Empty object (plain object, no own properties)
NaN- Empty
MaporSet
Returns false otherwise.
License
MIT