Method extend documentation
Merges the contents of two or more objects together into the first object.
Example
```javascript
bbn.fn.extend(
{prop1: 10, prop2: 20},
{prop1: 11, prop3: 21},
{prop2: 22, prop4: false},
{prop5: false, prop3: 45}
);
// {prop1: 11, prop2: 22, prop3: 45, prop4: false, prop5: false}
```
Example
```javascript
bbn.fn.extend(
{
prop1: [3, 5, 6],
prop2: {
subprop1: 87,
subprop2: 100
}
}, {
prop1: 11,
prop3: [8, 12, {aProperty: 1, anotherProperty: true}, 26]
}, {
prop2: {
subprop1: 90,
subprop3: 25
},
prop4: false
}, {
prop5: false,
prop3: [8, 45, {anotherProperty: false, andAnother: true}]
}
);
// {
// prop1: 11,
// prop2: {subprop1: 90, subprop3: 25},
// prop3: [8, 45, {anotherProperty: false, andAnother: true}],
// prop4: false,
// prop5: false
// }
```
Example
```javascript
// Deep
bbn.fn.extend(
true,
{
prop1: [3, 5, 6],
prop2: {
subprop1: 87,
subprop2: 100
}
}, {
prop1: 11,
prop3: [8, 12, {aProperty: 1, anotherProperty: true}, 26]
}, {
prop2: {
subprop1: 90,
subprop3: 25
},
prop4: false
}, {
prop5: false,
prop3: [8, 45, {anotherProperty: false, andAnother: true}]
}
);
// {
// prop1: 11,
// prop2: {subprop1: 90, subprop3: 25},
// prop3: [8, 45, {aProperty: 1, anotherProperty: false, andAnother: true}, 26],
// prop4: false,
// prop5: false
// }
```
Merges the contents of two or more objects together into the first object. - A boolean true argument can be done to operate a deep extend. In this case,
the content of properties or subproperties arrays and objects will also be merged.
BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way
This website uses cookies to ensure you get the best experience on our website.
© 2011-2023
BBN Solutions