Skip to content

Commit

Permalink
Compact map w/ Promises.all usage
Browse files Browse the repository at this point in the history
  • Loading branch information
rw-access committed Feb 22, 2021
1 parent a5153ec commit 4311ef4
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,11 @@ export const getPackageRegistryRules = async (
const { paths } = await getRegistryPackage(DetectionRulesPackageName, pkgVersion);

const rulePaths = paths.filter(isRuleTemplate);
const rulePromises = rulePaths.map(async (path) => {
const content = JSON.parse(getAsset(path).toString('utf8'));
return content as AddPrepackagedRulesSchema;
const rulePromises = rulePaths.map<AddPrepackagedRulesSchema>((path) => {
return JSON.parse(getAsset(path).toString('utf8'));
});

return validateAllPrepackagedRules(await Promise.all(rulePromises));
return validateAllPrepackagedRules(rulePromises);
};

/**
Expand Down

0 comments on commit 4311ef4

Please sign in to comment.