1.0.0 • Published 5 years ago

@ngard/tiny-isempty v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

tiny-isempty

source bundle size build status license

A minimal-weight utility equivalent to lodash.isempty. For when every byte counts!

lodash.isempty bundle size tiny-isempty bundle size

Syntax

isEmpty(/* object */)

Parameters

object - The object to check for emptiness

Return

true if value is an empty object, collection, map, or set. false otherwise.

Objects are considered empty if they have no own enumerable string keyed properties.

Array-like values such as arguments objects, arrays, strings, or jQuery-like collections are considered empty if they have a length of 0. Similarly, maps and sets are considered empty if they have a size of 0.

Example

import { isEmpty } from '@ngard/tiny-isempty';

isEmpty({}); // true
isEmpty([]); // true
isEmpty(''); // true
isEmpty(new Map()); // true
isEmpty(Object.create(null)); // true