Tim van der Lippe | b97da6b | 2021-02-12 14:32:53 +0000 | [diff] [blame] | 1 | declare namespace astralRegex { |
| 2 | interface Options { |
| 3 | /** |
| 4 | Only match an exact string. Useful with `RegExp#test()` to check if a string is a astral symbol. Default: `false` _(Matches any astral symbols in a string)_ |
| 5 | */ |
| 6 | readonly exact?: boolean; |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | /** |
| 11 | Regular expression for matching [astral symbols](https://everything2.com/title/astral+plane). |
| 12 | |
| 13 | @returns A `RegExp` for matching astral symbols. |
| 14 | |
| 15 | @example |
| 16 | ``` |
| 17 | import astralRegex = require('astral-regex'); |
| 18 | |
| 19 | astralRegex({exact: true}).test('🦄'); |
| 20 | //=> true |
| 21 | |
| 22 | 'foo 🦄 💩 bar'.match(astralRegex()); |
| 23 | //=> ['🦄', '💩'] |
| 24 | ``` |
| 25 | */ |
| 26 | declare function astralRegex(options?: astralRegex.Options): RegExp; |
| 27 | |
| 28 | export = astralRegex; |