Skip to content

Commit

Permalink
fixed #10, fixed #11, fixed #12
Browse files Browse the repository at this point in the history
  • Loading branch information
sasaplus1 committed Jun 13, 2016
1 parent 28efe08 commit e43a591
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,17 @@ function recursiveCopy(target, customizer, clone, visited, reference) {
value = target[key];
index = indexOf(visited, value);

resultCopy = undefined;
result = undefined;
ref = undefined;

if (index === -1) {
resultCopy = copy(value, customizer);
result = (resultCopy !== null) ? resultCopy : value;

if (value !== null && /^(?:function|object)$/.test(typeof value)) {
visited.push(value);
reference.push(result);
} else {
ref = result;
}
} else {
// circular reference
Expand Down

0 comments on commit e43a591

Please sign in to comment.