aswi2020vldc-gitlab/templetes/node_modules/es-abstract/helpers/assign.js @ cfe48a96
1 | 3a515b92 | cagy | 'use strict'; |
---|---|---|---|
2 | |||
3 | var GetIntrinsic = require('../GetIntrinsic'); |
||
4 | |||
5 | var has = require('has'); |
||
6 | |||
7 | var $assign = GetIntrinsic('%Object%').assign; |
||
8 | |||
9 | module.exports = function assign(target, source) { |
||
10 | if ($assign) { |
||
11 | return $assign(target, source); |
||
12 | }
|
||
13 | |||
14 | // eslint-disable-next-line no-restricted-syntax
|
||
15 | for (var key in source) { |
||
16 | if (has(source, key)) { |
||
17 | // eslint-disable-next-line no-param-reassign
|
||
18 | target[key] = source[key]; |
||
19 | }
|
||
20 | }
|
||
21 | return target; |
||
22 | };
|