es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
15 lines (10 loc) • 477 B
JavaScript
;
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const isEqualsSameValueZero = require('../../_internal/isEqualsSameValueZero.js');
const assignValue = (object, key, value) => {
const objValue = object[key];
if (!(Object.hasOwn(object, key) && isEqualsSameValueZero.isEqualsSameValueZero(objValue, value)) || (value === undefined && !(key in object))) {
object[key] = value;
}
};
exports.assignValue = assignValue;