UNPKG

ts-regex-builder

Version:

Maintainable regular expressions for TypeScript and JavaScript.

1 lines 2.7 kB
{"version":3,"file":"char-escape.mjs","names":["any","precedence","pattern","digit","chars","nonDigit","word","nonWord","whitespace","nonWhitespace","notDigit","notWord","notWhitespace"],"sources":["../../../src/constructs/char-escape.ts"],"sourcesContent":["import type { CharacterEscape, EncodedRegex } from '../types';\n\n/**\n * Matches any single character.\n * Specifically this one is NOT a character escape.\n */\nexport const any: EncodedRegex = {\n precedence: 'atom',\n pattern: '.',\n};\n\n/**\n * Matches any digit (0-9).\n */\nexport const digit: CharacterEscape = {\n precedence: 'atom',\n pattern: '\\\\d',\n chars: ['\\\\d'],\n};\n\n/**\n * Matches any non-digit (0-9) character.\n */\nexport const nonDigit: CharacterEscape = {\n precedence: 'atom',\n pattern: '\\\\D',\n chars: ['\\\\D'],\n};\n\n/**\n * Matches any word character (alphanumeric or underscore).\n */\nexport const word: CharacterEscape = {\n precedence: 'atom',\n pattern: '\\\\w',\n chars: ['\\\\w'],\n};\n\n/**\n * Matches any non-word (alphanumeric or underscore) character.\n */\nexport const nonWord: CharacterEscape = {\n precedence: 'atom',\n pattern: '\\\\W',\n chars: ['\\\\W'],\n};\n\n/**\n * Matches any whitespace character (space, tab, newline, etc.).\n */\nexport const whitespace: CharacterEscape = {\n precedence: 'atom',\n pattern: '\\\\s',\n chars: ['\\\\s'],\n};\n\n/**\n * Matches any non-whitespace (space, tab, newline, etc.) character.\n */\nexport const nonWhitespace: CharacterEscape = {\n precedence: 'atom',\n pattern: '\\\\S',\n chars: ['\\\\S'],\n};\n\n/**\n * @deprecated Renamed to `nonDigit`.\n */\nexport const notDigit = nonDigit;\n\n/**\n * @deprecated Renamed to `nonWord`.\n */\nexport const notWord = nonWord;\n\n/**\n * @deprecated Renamed to `nonWhitespace`.\n */\nexport const notWhitespace = nonWhitespace;\n"],"mappings":"AAMA,OAAO,MAAMA,GAAiB,GAAG;EAC/BC,UAAU,EAAE,MAAM;EAClBC,OAAO,EAAE;AACX,CAAC;AAKD,OAAO,MAAMC,KAAsB,GAAG;EACpCF,UAAU,EAAE,MAAM;EAClBC,OAAO,EAAE,KAAK;EACdE,KAAK,EAAE,CAAC,KAAK;AACf,CAAC;AAKD,OAAO,MAAMC,QAAyB,GAAG;EACvCJ,UAAU,EAAE,MAAM;EAClBC,OAAO,EAAE,KAAK;EACdE,KAAK,EAAE,CAAC,KAAK;AACf,CAAC;AAKD,OAAO,MAAME,IAAqB,GAAG;EACnCL,UAAU,EAAE,MAAM;EAClBC,OAAO,EAAE,KAAK;EACdE,KAAK,EAAE,CAAC,KAAK;AACf,CAAC;AAKD,OAAO,MAAMG,OAAwB,GAAG;EACtCN,UAAU,EAAE,MAAM;EAClBC,OAAO,EAAE,KAAK;EACdE,KAAK,EAAE,CAAC,KAAK;AACf,CAAC;AAKD,OAAO,MAAMI,UAA2B,GAAG;EACzCP,UAAU,EAAE,MAAM;EAClBC,OAAO,EAAE,KAAK;EACdE,KAAK,EAAE,CAAC,KAAK;AACf,CAAC;AAKD,OAAO,MAAMK,aAA8B,GAAG;EAC5CR,UAAU,EAAE,MAAM;EAClBC,OAAO,EAAE,KAAK;EACdE,KAAK,EAAE,CAAC,KAAK;AACf,CAAC;AAKD,OAAO,MAAMM,QAAQ,GAAGL,QAAQ;AAKhC,OAAO,MAAMM,OAAO,GAAGJ,OAAO;AAK9B,OAAO,MAAMK,aAAa,GAAGH,aAAa","ignoreList":[]}