You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

_assignMergeValue.js 582B

1234567891011121314151617181920
  1. var baseAssignValue = require('./_baseAssignValue'),
  2. eq = require('./eq');
  3. /**
  4. * This function is like `assignValue` except that it doesn't assign
  5. * `undefined` values.
  6. *
  7. * @private
  8. * @param {Object} object The object to modify.
  9. * @param {string} key The key of the property to assign.
  10. * @param {*} value The value to assign.
  11. */
  12. function assignMergeValue(object, key, value) {
  13. if ((value !== undefined && !eq(object[key], value)) ||
  14. (value === undefined && !(key in object))) {
  15. baseAssignValue(object, key, value);
  16. }
  17. }
  18. module.exports = assignMergeValue;