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.

22 lines
451 B

4 years ago
  1. 'use strict';
  2. var GetIntrinsic = require('../GetIntrinsic');
  3. var has = require('has');
  4. var $assign = GetIntrinsic('%Object%').assign;
  5. module.exports = function assign(target, source) {
  6. if ($assign) {
  7. return $assign(target, source);
  8. }
  9. // eslint-disable-next-line no-restricted-syntax
  10. for (var key in source) {
  11. if (has(source, key)) {
  12. // eslint-disable-next-line no-param-reassign
  13. target[key] = source[key];
  14. }
  15. }
  16. return target;
  17. };