Source

object/isDeepEmpty.js

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var isEmpty_1 = __importDefault(require("lodash/isEmpty"));
var array_1 = require("../array");
var isObj_1 = __importDefault(require("./isObj"));
/**
 * Like lodash/isEmpty but also cater empty nested object and array cases.
 * @param o
 * @category object
 * @module isDeepEmpty
 */
var isDeepEmpty = function (o) {
    if ((0, isObj_1.default)(o))
        return Object.keys(o).length === 0 || Object.values(o).every(function (val) { return isDeepEmpty(val); });
    if ((0, array_1.isArr)(o))
        return o.length === 0 || o.every(function (item) { return isDeepEmpty(item); });
    return (0, isEmpty_1.default)(o);
};
exports.default = isDeepEmpty;