mergeIntoFast.js 617 B

1234567891011121314151617181920212223242526
  1. /**
  2. * Copyright (c) Facebook, Inc. and its affiliates.
  3. *
  4. * This source code is licensed under the MIT license found in the
  5. * LICENSE file in the root directory of this source tree.
  6. *
  7. * @format
  8. * @flow
  9. */
  10. 'use strict';
  11. /**
  12. * Faster version of `mergeInto` that doesn't check its arguments and
  13. * also copies over prototype inherited properties.
  14. *
  15. * @param {object} one Object to assign to.
  16. * @param {object} two Object to assign from.
  17. */
  18. const mergeIntoFast = function(one: Object, two: Object): void {
  19. for (const keyTwo in two) {
  20. one[keyTwo] = two[keyTwo];
  21. }
  22. };
  23. module.exports = mergeIntoFast;