@ts-simple/is-empty
v1.0.0
Published
Check if object is empty
Downloads
3
Readme
is-empty
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*/