Skip to content

Commit

Permalink
chore: tiny perf tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
lukeed committed Mar 24, 2020
1 parent 5437ea5 commit 9863715
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ module.exports = function (args, opts) {
}
}

opts.boolean.forEach(key => {
opts.boolean = opts.boolean.concat(opts.alias[key] = opts.alias[key] || []);
});
for (i=opts.boolean.length; i-- > 0;) {
arr = opts.alias[opts.boolean[i]] || [];
for (j=arr.length; j-- > 0;) opts.boolean.push(arr[j]);
}

opts.string.forEach(key => {
opts.string = opts.string.concat(opts.alias[key] = opts.alias[key] || []);
});
for (i=opts.string.length; i-- > 0;) {
arr = opts.alias[opts.string[i]] || [];
for (j=arr.length; j-- > 0;) opts.string.push(arr[j]);
}

if (defaults) {
for (k in opts.default) {
Expand Down

0 comments on commit 9863715

Please sign in to comment.