Skip to content

Commit

Permalink
Fixes non-linear startup time increase for large folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Nikitin committed Jun 28, 2016
1 parent aac0c51 commit 8b7ced6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ helper.isDir = function isDir (dir) {

// Create a `key:[]` if doesnt exist on `obj` then push or concat the `val`
helper.objectPush = function objectPush (obj, key, val) {
if (obj[key] == null) {
obj[key] = [];
var arr = obj[key];
if (arr == null) {
obj[key] = arr = [];
}
if (Array.isArray(val)) {
obj[key] = obj[key].concat(val);
} else if (val) {
obj[key].push(val);
obj[key] = arr = helper.unique(arr, val);
} else if (val && arr.indexOf(val) === -1) {
arr.push(val);
}
obj[key] = helper.unique(obj[key]);
return obj[key];
return arr;
};

// Ensures the dir is marked with path.sep
Expand Down

1 comment on commit 8b7ced6

@chebum
Copy link

@chebum chebum commented on 8b7ced6 Jun 28, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #222

Please sign in to comment.