hap-nodejs
Version:
HAP-NodeJS is a Node.js implementation of HomeKit Accessory Server.
22 lines • 680 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.clone = clone;
/**
* A simple clone function that also allows you to pass an "extend" object whose properties will be
* added to the cloned copy of the original object passed.
* @group Utils
*/
function clone(object, extend) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const cloned = {};
for (const [key, value] of Object.entries(object)) {
cloned[key] = value;
}
if (extend) {
for (const [key, value] of Object.entries(extend)) {
cloned[key] = value;
}
}
return cloned;
}
//# sourceMappingURL=clone.js.map
;