MCPcopy Create free account
hub / github.com/Lemoncode/fonk / assignValue

Function assignValue

src/helpers/set.js:458–466  ·  view source on GitHub ↗

* Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the p

(object, key, value)

Source from the content-addressed store, hash-verified

456 * @param {*} value The value to assign.
457 */
458function assignValue(object, key, value) {
459 var objValue = object[key];
460 if (
461 !(hasOwnProperty.call(object, key) && eq(objValue, value)) ||
462 (value === undefined && !(key in object))
463 ) {
464 object[key] = value;
465 }
466}
467
468/**
469 * Gets the index at which the `key` is found in `array` of key-value pairs.

Callers 1

baseSetFunction · 0.85

Calls 1

eqFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…