assign.js 351 B

1234567891011121314151617
  1. var bind = require('function-bind');
  2. var has = bind.call(Function.call, Object.prototype.hasOwnProperty);
  3. var $assign = Object.assign;
  4. module.exports = function assign(target, source) {
  5. if ($assign) {
  6. return $assign(target, source);
  7. }
  8. for (var key in source) {
  9. if (has(source, key)) {
  10. target[key] = source[key];
  11. }
  12. }
  13. return target;
  14. };