@ts-simple/is-empty
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

is-empty

Build Status Coverage Status

npm npm bundle size (scoped version) NPM

Simple function to check if object is empty. Can validate all type of objects by set strict to false.

API

  • isEmpty(object:Object, strict: boolean = true) => boolean | NAO Exception (Not An Object Exception);
  • NAO

Usage

import { isEmpty } from '@ts-simple/is-empty'

const object = { a: 1, b: 2 };
console.log(isEmpty(object));

/*  Expected result is false*/

const object = {};
console.log(isEmpty(object));

/*  Expected result is true*/

const object = [];
console.log(isEmpty(object));

/*  Expected result is NAO Error*/

const object = [];
console.log(isEmpty(object, false));

/*  Expected result is true*/

Readme

Keywords

Package Sidebar

Install

npm i @ts-simple/is-empty

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

4.43 kB

Total Files

6

Last publish

Collaborators

  • arturo.silvelo