UNPKG

@novo-learning/novo-sdk

Version:

SDK for the Novolanguage Speech Analysis API

38 lines 1.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mergeDeep = exports.isObject = void 0; const isObject = (item) => { return item != null && typeof item === 'object' && !Array.isArray(item); }; exports.isObject = isObject; const forbiddenProperties = ['__proto__', 'constructor', 'prototype']; const mergeDeep = (target, ...sources) => { if (!sources.length) { return target; } const source = sources.shift(); if ((0, exports.isObject)(target) && (0, exports.isObject)(source)) { for (const key in source) { if (!source.hasOwnProperty(key) || forbiddenProperties.includes(key)) { continue; } const value = source[key]; if ((0, exports.isObject)(value)) { if (!target[key]) { Object.assign(target, { [key]: {}, }); } (0, exports.mergeDeep)(target[key], value); } else { Object.assign(target, { [key]: source[key], }); } } } return (0, exports.mergeDeep)(target, ...sources); }; exports.mergeDeep = mergeDeep; //# sourceMappingURL=merge-deep.js.map