UNPKG

@json-layout/core

Version:

Compilation and state management utilities for JSON Layout.

12 lines (10 loc) 209 B
/** @type {Record<string, RegExp>} */ const cache = {} /** * @param {string} str * @returns {RegExp} */ export function getRegexp (str) { cache[str] = cache[str] ?? new RegExp(str) return cache[str] }