MCPcopy Index your code
hub / github.com/formatjs/formatjs / generateRuleRegex

Function generateRuleRegex

packages/intl-segmenter/segmenter.ts:67–75  ·  view source on GitHub ↗
(
  rule: string,
  variables: Record<string, string>,
  after: boolean
)

Source from the content-addressed store, hash-verified

65 * @returns
66 */
67const generateRuleRegex = (
68 rule: string,
69 variables: Record<string, string>,
70 after: boolean
71) => {
72 return new RegExp(
73 `${after ? '^' : ''}${replaceVariables(variables, rule)}${after ? '' : '$'}`
74 )
75}
76
77const prepareLocaleSegmentationRules = (
78 segmentationTypeValue: SegmentationTypeTypeRaw

Callers 1

Calls 1

replaceVariablesFunction · 0.70

Tested by

no test coverage detected