Skip to content

Commit

Permalink
Replace [...set] with Array.from(set)
Browse files Browse the repository at this point in the history
  • Loading branch information
etimberg committed Jun 12, 2021
1 parent 6a46cc3 commit e075fdf
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/core/core.config.js
Expand Up @@ -276,7 +276,7 @@ export default class Config {
keys.forEach(key => addIfFound(scopes, descriptors, key));
});

const array = [...scopes];
const array = Array.from(scopes);
if (keysCached.has(keyLists)) {
cache.set(keyLists, array);
}
Expand Down
6 changes: 1 addition & 5 deletions src/helpers/helpers.collection.js
Expand Up @@ -154,9 +154,5 @@ export function _arrayUnique(items) {
return items;
}

const result = [];
set.forEach(item => {
result.push(item);
});
return result;
return Array.from(set);
}
6 changes: 3 additions & 3 deletions src/helpers/helpers.config.js
Expand Up @@ -217,7 +217,7 @@ function _resolveScriptable(prop, value, target, receiver) {
const {_proxy, _context, _subProxy, _stack} = target;
if (_stack.has(prop)) {
// @ts-ignore
throw new Error('Recursion detected: ' + [..._stack].join('->') + '->' + prop);
throw new Error('Recursion detected: ' + Array.from(_stack).join('->') + '->' + prop);
}
_stack.add(prop);
value = value(_context, _subProxy || receiver);
Expand Down Expand Up @@ -290,7 +290,7 @@ function createSubResolver(parentScopes, resolver, prop, value) {
return false;
}
}
return _createResolver([...set], [''], rootScopes, fallback,
return _createResolver(Array.from(set), [''], rootScopes, fallback,
() => subGetTarget(resolver, prop, value));
}

Expand Down Expand Up @@ -353,5 +353,5 @@ function resolveKeysFromAllScopes(scopes) {
set.add(key);
}
}
return [...set];
return Array.from(set);
}

0 comments on commit e075fdf

Please sign in to comment.