UNPKG

@technobuddha/library

Version:
43 lines (42 loc) 1.37 kB
"use strict"; var __values = (this && this.__values) || function(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.clearObject = void 0; /** * Delete all own enumerable string properties from an object * * @remark The input argument is mutated in place * * @typeParam T Type of values within the object * @param input Object to clear all properties * @return Original {@code input} with all properties deleted. */ function clearObject(input) { var e_1, _a; try { for (var _b = __values(Object.keys(input)), _c = _b.next(); !_c.done; _c = _b.next()) { var key = _c.value; delete input[key]; } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return input; } exports.clearObject = clearObject; exports.default = clearObject;