deep-override
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

deep-override

recursive object extending & overriding

const override = require('deep-override');

const target = {
  Name: 'Snow',
  Age: 10,
  Addresses: [
    {
      House: 'Stark',
      Castle: 'WinterFell'
    }
  ]
};

const source = {
  Pet: 'Ghost',
  Addresses: [
    {
      House: 'Dragon'
    }
  ]
}

override(target, source);

console.log(target);
/*
{
  Name: 'Snow',
  Age: 10,
  Pet: 'Ghost',
  Addresses: [
    {
      House: 'Dragon',
      Castle: 'WinterFell'
    }
  ]
}
*/

Package Sidebar

Install

npm i deep-override

Weekly Downloads

173,272

Version

1.0.2

License

MIT

Unpacked Size

4.9 kB

Total Files

5

Last publish

Collaborators

  • asaianudeep