parsePublicodes

API / publicodes / parsePublicodes

function parsePublicodes<ContextNames, NewRulesNames>(rawRules, partialContext): Pick<Context<ContextNames | NewRulesNames>, "parsedRules" | "nodesTypes" | "referencesMaps" | "rulesReplacements">

Experimental

Parse a set of publicodes rules

Allows to add new rules to a previously parsed set of rules (partialContext)

Type Parameters

Type Parameter
ContextNames extends string
NewRulesNames extends string

Parameters

ParameterTypeDescription
rawRulesPartial<Record<NewRulesNames, RawRule>>The new rules to parse
partialContextPartial<Context<ContextNames>>The context to use for the parsing (if we want to add a set of rules to a previously parsed one)

Returns

Pick<Context<ContextNames | NewRulesNames>, "parsedRules" | "nodesTypes" | "referencesMaps" | "rulesReplacements">

The new context containing the parsed rules, the nodes types, the references maps and the rules replacements

Defined in

packages/core/src/parsePublicodes.ts:108