isEmptyObject
isEmptyObject(val?: any, checkOwnProperty?: boolean) => boolean
Check a parameter is empty Object.
Array, Date, Class, Function, Regex, Symoble are return false.
When use checkOwnProperty
option true
, it check a object has only own property or not.
Install
$ npm install is-empty-object-x
usage
; ; // => true;
Build
$ npm run build
Test
$ npm run test
;// => false;// => false;// => false
Boolean
;// => false;// => false
String
;// => false;// => false;;// => false
Number
;// => false;// => false;// => false;// => false;// => false;// => false
Array
;// => false
Object
;// => true;// => true;// => false;// => false
Date
const date = ;;// => false
Function
const func = { };;// => false
Symbol
const symbol1 = Symbol;;// => falseconst symbol2 = Symbol'a';;// => false
RegExp
const regex1 = /\w+/;;// => falseconst regex2 = '\\w+';;// => false
Class
{ }const classObj = ;;// => false
checkOwnProperty option
const o = ;oa = 'b';const obj = Object;obja; //=> 'b'obj; // => false ;// => true // use checkOwnProperty Option!;// => false