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

This commit is contained in:
Evert Timberg 2021-06-12 13:34:54 -04:00 committed by GitHub
parent 9db3680440
commit dc373f3aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 9 deletions

View File

@ -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);
}

View File

@ -154,9 +154,5 @@ export function _arrayUnique(items) {
return items;
}
const result = [];
set.forEach(item => {
result.push(item);
});
return result;
return Array.from(set);
}

View File

@ -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);
@ -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));
}
@ -353,5 +353,5 @@ function resolveKeysFromAllScopes(scopes) {
set.add(key);
}
}
return [...set];
return Array.from(set);
}