Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace [...set] with Array.from(set) #9260

Merged
merged 1 commit into from Jun 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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);
}