@beenotung/tslib
Version:
utils library in Typescript
20 lines (19 loc) • 564 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.muteObject = muteObject;
const noop = () => {
return noop;
};
// e.g. to mute cli-progress (progress bar)
function muteObject(target) {
let prototype = target;
while (prototype !== null) {
for (const name of Object.getOwnPropertyNames(prototype)) {
const value = target[name];
if (typeof value === 'function') {
target[name] = noop;
}
}
prototype = Object.getPrototypeOf(prototype);
}
}