Sha256: 8b891557dcdb1969105e2d102fb57ecaa8efcb35db53fd5f64c0d4f771afa507

Contents?: true

Size: 919 Bytes

Versions: 2

Compression:

Stored size: 919 Bytes

Contents

/**
 @module @ember/polyfills
*/
/**
  Merge the contents of two objects together into the first object.

  ```javascript
  import { merge } from '@ember/polyfills';

  merge({ first: 'Tom' }, { last: 'Dale' }); // { first: 'Tom', last: 'Dale' }
  var a = { first: 'Yehuda' };
  var b = { last: 'Katz' };
  merge(a, b); // a == { first: 'Yehuda', last: 'Katz' }, b == { last: 'Katz' }
  ```

  @method merge
  @static
  @for @ember/polyfills
  @param {Object} original The object to merge into
  @param {Object} updates The object to copy properties from
  @return {Object}
  @public
*/
export default function merge(original, updates) {
    if (updates === null || typeof updates !== 'object') {
        return original;
    }
    let props = Object.keys(updates);
    let prop;
    for (let i = 0; i < props.length; i++) {
        prop = props[i];
        original[prop] = updates[prop];
    }
    return original;
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
discourse-ember-source-3.5.1.1 dist/es/@ember/polyfills/lib/merge.js
discourse-ember-source-3.5.1.0 dist/dist/es/@ember/polyfills/lib/merge.js