index.d.ts 863 B

123456789101112131415161718192021222324
  1. // Type definitions for grapheme-splitter
  2. /*~ Note that ES6 modules cannot directly export class objects.
  3. *~ This file should be imported using the CommonJS-style:
  4. *~
  5. *~ import GraphemeSplitter = require('grapheme-splitter')
  6. *~
  7. *~ Refer to the documentation to understand common
  8. *~ workarounds for this limitation of ES6 modules.
  9. *~
  10. *~ https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html
  11. */
  12. declare class GraphemeSplitter {
  13. constructor();
  14. /** iterate the string to an iterable iterator of grapheme clusters */
  15. iterateGraphemes(s: string): IterableIterator<string>;
  16. /** split the string to an array of grapheme clusters */
  17. splitGraphemes(s: string): string[];
  18. /** count the number of grapheme clusters in a string */
  19. countGraphemes(s: string): number;
  20. }
  21. export = GraphemeSplitter;