ts-regex-builder
Version:
Maintainable regular expressions for TypeScript and JavaScript.
1 lines • 956 B
Source Map (JSON)
{"version":3,"file":"lookahead.mjs","names":["encode","lookahead","sequence","precedence","pattern"],"sources":["../../../src/constructs/lookahead.ts"],"sourcesContent":["import { encode } from '../encoder';\nimport type { EncodedRegex, RegexSequence } from '../types';\n\n/**\n * Positive lookahead assertion.\n *\n * A positive lookahead assertion is a zero-width assertion that matches a group of characters only if it is followed by a specific group of characters.\n *\n * @example\n * ```ts\n * lookahead(\"a\");\n * // /(?=a)/\n *\n * lookahead([\"a\", \"b\", \"c\"]);\n * // /(?=abc)/\n * ```\n */\nexport function lookahead(sequence: RegexSequence): EncodedRegex {\n return {\n precedence: 'atom',\n pattern: `(?=${encode(sequence).pattern})`,\n };\n}\n"],"mappings":"SAASA,MAAM;AAiBf,OAAO,SAASC,SAASA,CAACC,QAAuB,EAAgB;EAC/D,OAAO;IACLC,UAAU,EAAE,MAAM;IAClBC,OAAO,EAAG,MAAKJ,MAAM,CAACE,QAAQ,CAAC,CAACE,OAAQ;EAC1C,CAAC;AACH","ignoreList":[]}