Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export async function readRuleset(uris: string | string[], opts?: IRulesetReadOptions): Promise {
const base: IRuleset = {
rules: {},
functions: {},
};
const processedRulesets = new Set();
const processRuleset = createRulesetProcessor(processedRulesets, new Cache(), opts);
for (const uri of Array.isArray(uris) ? new Set([...uris]) : [uris]) {
processedRulesets.clear(); // makes sure each separate ruleset starts with clear list
const resolvedRuleset = await processRuleset(uri, uri);
if (resolvedRuleset === null) continue;
Object.assign(base.rules, resolvedRuleset.rules);
Object.assign(base.functions, resolvedRuleset.functions);
}
return base;
}