2023-12-28 23:41:32 +08:00
|
|
|
'use strict';
|
2023-12-18 13:12:25 +08:00
|
|
|
|
2023-12-28 23:41:32 +08:00
|
|
|
var GetIntrinsic = require('get-intrinsic');
|
|
|
|
|
|
|
|
var hasOwn = require('hasown');
|
|
|
|
|
|
|
|
var $assign = GetIntrinsic('%Object.assign%', true);
|
2023-12-18 13:12:25 +08:00
|
|
|
|
|
|
|
module.exports = function assign(target, source) {
|
|
|
|
if ($assign) {
|
|
|
|
return $assign(target, source);
|
|
|
|
}
|
|
|
|
|
2023-12-28 23:41:32 +08:00
|
|
|
// eslint-disable-next-line no-restricted-syntax
|
2023-12-18 13:12:25 +08:00
|
|
|
for (var key in source) {
|
2023-12-28 23:41:32 +08:00
|
|
|
if (hasOwn(source, key)) {
|
|
|
|
// eslint-disable-next-line no-param-reassign
|
2023-12-18 13:12:25 +08:00
|
|
|
target[key] = source[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return target;
|
|
|
|
};
|