index.d.ts 681 B

12345678910111213141516171819202122232425262728
  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. Regular expression for matching [astral symbols](https://everything2.com/title/astral+plane).
  11. @returns A `RegExp` for matching astral symbols.
  12. @example
  13. ```
  14. import astralRegex = require('astral-regex');
  15. astralRegex({exact: true}).test('🦄');
  16. //=> true
  17. 'foo 🦄 💩 bar'.match(astralRegex());
  18. //=> ['🦄', '💩']
  19. ```
  20. */
  21. declare function astralRegex(options?: astralRegex.Options): RegExp;
  22. export = astralRegex;