empty-php
Version:
Exact replica of the PHP empty function in for JavaScript and TypeScript
3 lines (2 loc) • 496 B
JavaScript
function t(t){if(null==t)return!0;if("boolean"==typeof t)return!t;if("number"==typeof t)return 0===t;if("string"==typeof t)return"0"===t||0===t.length;if(Array.isArray(t))return 0===t.length;if(t.toString==Object.prototype.toString)switch(t.toString()){case"[object File]":case"[object Map]":case"[object Set]":return 0===t.size;case"[object Object]":for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}return!1}export{t as empty};
//# sourceMappingURL=index.esm.js.map