1
0
mirror of https://github.com/svg/svgo.git synced 2025-07-29 20:21:14 +03:00

refactor: replace uses of for in (#1382)

Replace the uses of `for in` with `for of` and `Object.entries`/`Object.values`/`Object.keys`.

One case was further simplified by using a spread.
This commit is contained in:
Sebastian Kreft
2021-02-27 17:17:30 -03:00
committed by GitHub
parent ed89fbe881
commit 0394bf0ea6
5 changed files with 24 additions and 32 deletions

View File

@ -54,13 +54,7 @@ exports.fn = function(ast, options) {
};
function cloneObject(obj) {
var result = {};
for (var key in obj) {
result[key] = obj[key];
}
return result;
return {...obj};
}
function findStyleElems(ast) {
@ -149,9 +143,9 @@ function collectUsageData(ast, options) {
safe = true;
}
for (var key in rawData) {
for (const [key, data] of Object.entries(rawData)) {
if (shouldFilter(options, key)) {
usageData[key] = Object.keys(rawData[key]);
usageData[key] = Object.keys(data);
hasData = true;
}
}