Installation
Node.js
npm install defaulty --save
Example
const defaulty = ; const defaultObj = a: 1 b: 2 c: 3 d: a: 5 b: 2;let targetObj = a: 4 b: 5 d: a: 1; ; console; //=> {a: 4, b: 5, c: 3, d: {a: 1, b: 2}};
Exclude default properties
const defaultObj = a: 1 b: 2 c: 3 d: a: 5 b: 2 x: 1 y: 2;let targetObj = a: 4 b: 5 d: a: 1; ; console; //=> {a: 4, b: 5, c: 3, d: {a: 1, b: 2}};
Copy target object
const defaultObj = a: 1 b: 2 c: 3 d: a: 5 b: 2;const targetObj = a: 4 b: 5 d: a: 1; const newTargetObject = defaulty; console; //=> {a: 4, b: 5, c: 3, d: {a: 1, b: 2}};console; //=> {a: 4, b: 5, d: {a: 1}};
Changelog
You can view the changelog here
License
Defaulty is open-sourced software licensed under the MIT license