Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use for...of and remove deprecation notice (#7)
  • Loading branch information
kevva authored and sindresorhus committed Jun 16, 2017
1 parent 956f1ce commit 3962307
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions index.js
Expand Up @@ -8,11 +8,6 @@ module.exports = (obj, opts) => {

opts = opts || {};

// DEPRECATED
if (typeof opts === 'function') {
throw new TypeError('Specify the compare function as an option instead');
}

const deep = opts.deep;
const seenInput = [];
const seenOutput = [];
Expand All @@ -30,18 +25,11 @@ module.exports = (obj, opts) => {
seenInput.push(x);
seenOutput.push(ret);

for (let i = 0; i < keys.length; i++) {
const key = keys[i];
for (const key of keys) {
const val = x[key];

if (deep && Array.isArray(val)) {
const retArr = [];

for (let j = 0; j < val.length; j++) {
retArr[j] = isPlainObj(val[j]) ? sortKeys(val[j]) : val[j];
}

ret[key] = retArr;
ret[key] = val.map(y => isPlainObj(y) ? sortKeys(y) : y);
continue;
}

Expand Down

0 comments on commit 3962307

Please sign in to comment.