Skip to content

Documentation / @ripl/core / parsePatternCached

Function: parsePatternCached() ​

parsePatternCached(value): Pattern | null

Defined in: packages/core/src/pattern/parser.ts:134

Parses a pattern(...) paint string via parsePattern, memoizing the result in a bounded LRU cache shared by every rendering backend.

Backends should prefer this over parsePattern on any render path, where the same paint string resolves for every element on every frame.

The returned object is shared between callers and must not be mutated; parse it yourself with parsePattern when a private, mutable copy is required.

Parameters ​

ParameterTypeDescription
valuestringThe paint string to parse, e.g. pattern(diagonal, #1a6, #fff0, 8).

Returns ​

Pattern | null

The parsed pattern, or null when the string is not a valid pattern.