UNPKG

not-empty-object

Version:

Shortcut. Check if a thing is a "not-empty-object". Also the opposite, if it's "not-object-or-is-empty".

18 lines (16 loc) 302 B
'use strict'; /** * Shortcut. Is an object and has it's own properties. */ module.exports = function notEmptyObject(obj) { if (obj == null) { return false; } if (typeof obj !== 'object') { return false; } if (Object.keys(obj).length <= 0) { return false; } return true; };