extend.js 386 B

123456789
  1. module.exports = function extend(target, source) {
  2. /* FIXME consider using Object.entries instead - this will also include keys in the prototype if the prototype is an object with properties. Changing this may be backwards incompatible in edge cases. */
  3. for (const key in source) {
  4. if (source[key] !== undefined) {
  5. target[key] = source[key];
  6. }
  7. }
  8. return target;
  9. };