Skip to content

Commit 80b6422

Browse files
committed
Function that copies objects
// Function that copies objects and their properties. // Doesn't work with prototypes.
1 parent 29fa76e commit 80b6422

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

extend.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Function that copies objects and their properties.
22
// Doesn't work with prototypes.
33

4+
// shallow copy
45
function extend(parent, child) {
56
var i;
67
child = child || {};
@@ -12,6 +13,7 @@ function extend(parent, child) {
1213
return child;
1314
}
1415

16+
// full copy
1517
function extendDeep(parent, child) {
1618
var i;
1719
var toStr = Object.prototype.toString;

0 commit comments

Comments
 (0)