main
Last change
on this file since d565449 was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
897 bytes
|
Rev | Line | |
---|
[d565449] | 1 | import baseAssignValue from './_baseAssignValue.js';
|
---|
| 2 | import eq from './eq.js';
|
---|
| 3 |
|
---|
| 4 | /** Used for built-in method references. */
|
---|
| 5 | var objectProto = Object.prototype;
|
---|
| 6 |
|
---|
| 7 | /** Used to check objects for own properties. */
|
---|
| 8 | var hasOwnProperty = objectProto.hasOwnProperty;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * Assigns `value` to `key` of `object` if the existing value is not equivalent
|
---|
| 12 | * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
---|
| 13 | * for equality comparisons.
|
---|
| 14 | *
|
---|
| 15 | * @private
|
---|
| 16 | * @param {Object} object The object to modify.
|
---|
| 17 | * @param {string} key The key of the property to assign.
|
---|
| 18 | * @param {*} value The value to assign.
|
---|
| 19 | */
|
---|
| 20 | function assignValue(object, key, value) {
|
---|
| 21 | var objValue = object[key];
|
---|
| 22 | if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
|
---|
| 23 | (value === undefined && !(key in object))) {
|
---|
| 24 | baseAssignValue(object, key, value);
|
---|
| 25 | }
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | export default assignValue;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.