extend.js (345B)
1import hasOwnProp from './has-own-prop'; 2 3export default function extend(a, b) { 4 for (var i in b) { 5 if (hasOwnProp(b, i)) { 6 a[i] = b[i]; 7 } 8 } 9 10 if (hasOwnProp(b, 'toString')) { 11 a.toString = b.toString; 12 } 13 14 if (hasOwnProp(b, 'valueOf')) { 15 a.valueOf = b.valueOf; 16 } 17 18 return a; 19}