UNPKG

@kubit-ui-web/react-components

Version:

Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience

31 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.mergeObjects = void 0; const mergeObjects = (target, ...sources) => { const result = Array.isArray(target) ? [] : { ...target }; for (const source of sources) { for (const key in source) { // eslint-disable-next-line no-prototype-builtins if (source.hasOwnProperty(key)) { if (typeof source[key] === 'object' && source[key] !== null) { if ( // eslint-disable-next-line no-prototype-builtins !result.hasOwnProperty(key) || typeof result[key] !== 'object' || result[key] === null) { result[key] = Array.isArray(source[key]) ? [] : {}; } result[key] = (0, exports.mergeObjects)(result[key], source[key]); } else { result[key] = source[key]; } } } } return result; }; exports.mergeObjects = mergeObjects; //# sourceMappingURL=mergeObjects.js.map