main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
932 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import eq from './eq.js';
|
---|
| 2 |
|
---|
| 3 | /** Used for built-in method references. */
|
---|
| 4 | var objectProto = Object.prototype;
|
---|
| 5 |
|
---|
| 6 | /** Used to check objects for own properties. */
|
---|
| 7 | var hasOwnProperty = objectProto.hasOwnProperty;
|
---|
| 8 |
|
---|
| 9 | /**
|
---|
| 10 | * Used by `_.defaults` to customize its `_.assignIn` use to assign properties
|
---|
| 11 | * of source objects to the destination object for all destination properties
|
---|
| 12 | * that resolve to `undefined`.
|
---|
| 13 | *
|
---|
| 14 | * @private
|
---|
| 15 | * @param {*} objValue The destination value.
|
---|
| 16 | * @param {*} srcValue The source value.
|
---|
| 17 | * @param {string} key The key of the property to assign.
|
---|
| 18 | * @param {Object} object The parent object of `objValue`.
|
---|
| 19 | * @returns {*} Returns the value to assign.
|
---|
| 20 | */
|
---|
| 21 | function customDefaultsAssignIn(objValue, srcValue, key, object) {
|
---|
| 22 | if (objValue === undefined ||
|
---|
| 23 | (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {
|
---|
| 24 | return srcValue;
|
---|
| 25 | }
|
---|
| 26 | return objValue;
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | export default customDefaultsAssignIn;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.