es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
9 lines (8 loc) • 320 B
JavaScript
import { eq } from "../util/eq.mjs";
//#region src/compat/_internal/assignValue.ts
const assignValue = (object, key, value) => {
const objValue = object[key];
if (!(Object.hasOwn(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) object[key] = value;
};
//#endregion
export { assignValue };