JSPM

is-empty-data

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

Tiny utility to check if a value is empty

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-data

Usage

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])); // false

API

isEmptyValue(value)

Returns true if the value is considered empty:

  • null or undefined
  • Empty string (after trim)
  • Empty array
  • Empty object (plain object, no own properties)
  • NaN
  • Empty Map or Set

Returns false otherwise.

License

MIT