Skip to content

Commit

Permalink
Micro perf enhancement (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
roderickhsiao authored and mridgway committed May 31, 2016
1 parent b58bbf5 commit 33274ce
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lib/cloneDeep.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
var isA = require('./isA');

module.exports = function cloneDeep(o) {
var newO,
i;
var newO;

if (typeof o !== 'object') {
return o;
}
if (!o) {
if (!o || typeof o !== 'object') {
return o;
}

if ('[object Array]' === Object.prototype.toString.apply(o)) {
if (isA(o, Array)) {
newO = [];
for (i = 0; i < o.length; i += 1) {
for (var i = 0, j = o.length; i < j; i += 1) {
newO[i] = cloneDeep(o[i]);
}
return newO;
Expand Down

0 comments on commit 33274ce

Please sign in to comment.