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) 313 B
'use strict'; /** * Shortcut. Not an object or doesn't have it's own properties. */ module.exports = function notObjectOrIsEmpty(obj) { if (obj == null) { return true; } if (typeof obj !== 'object') { return true; } if (Object.keys(obj).length <= 0) { return true; } return false; };