1 | export as namespace regenerate;
|
2 | export = regenerate;
|
3 |
|
4 | type RegenerateArgValue = string | number | regenerate;
|
5 | type RegenerateArgValueOrArray = RegenerateArgValue | readonly RegenerateArgValueOrArray[];
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | declare function regenerate(...values: readonly RegenerateArgValueOrArray[]): regenerate;
|
19 | declare class regenerate {
|
20 | constructor(...values: readonly RegenerateArgValueOrArray[]);
|
21 |
|
22 | /**
|
23 | * Any arguments passed to `add()` are added to the set.
|
24 | *
|
25 | * Both code points (numbers) and symbols (strings consisting of a single Unicode symbol)
|
26 | * are accepted, as well as arrays containing values of these types.
|
27 | *
|
28 | * It’s also possible to pass in a Regenerate instance.
|
29 | * Doing so adds all code points in that instance to the current set.
|
30 | */
|
31 | add(value: RegenerateArgValueOrArray, ...rest: readonly RegenerateArgValueOrArray[]): this;
|
32 |
|
33 | /**
|
34 | * Any arguments passed to `remove()` are removed from the set.
|
35 | *
|
36 | * Both code points (numbers) and symbols (strings consisting of a single Unicode symbol)
|
37 | * are accepted, as well as arrays containing values of these types.
|
38 | *
|
39 | * It’s also possible to pass in a Regenerate instance.
|
40 | * Doing so removes all code points in that instance from the current set.
|
41 | */
|
42 | remove(value: RegenerateArgValueOrArray, ...rest: readonly RegenerateArgValueOrArray[]): this;
|
43 |
|
44 | /**
|
45 | * Adds a range of code points from `start` to `end` (inclusive) from the set.
|
46 | *
|
47 | * Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted.
|
48 | *
|
49 | * @param start The start of the range to add.
|
50 | * @param end The end of the range to add.
|
51 | */
|
52 | addRange(start: string | number, end: string | number): this;
|
53 |
|
54 | /**
|
55 | * Removes a range of code points from `start` to `end` (inclusive) from the set.
|
56 | *
|
57 | * Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted.
|
58 | *
|
59 | * @param start The start of the range to remove.
|
60 | * @param end The end of the range to remove.
|
61 | */
|
62 | removeRange(start: string | number, end: string | number): this;
|
63 |
|
64 | /**
|
65 | * Removes any code points from the set that are not present in both the set and the given `codePoints` array.
|
66 | *
|
67 | * @param argument must be an array of numeric code point values, i.e. numbers, or a Regenerate instance.
|
68 | */
|
69 | intersection(argument: regenerate | readonly number[]): this;
|
70 |
|
71 | /**
|
72 | * Returns `true` if the given value is part of the set, and `false` otherwise.
|
73 | *
|
74 | * Both code points (numbers) and symbols (strings consisting of a single Unicode symbol) are accepted.
|
75 | *
|
76 | * @param codePoint The codepoint to check for
|
77 | */
|
78 | contains(codePoint: string | number): boolean;
|
79 |
|
80 | /**
|
81 | * Returns a clone of the current code point set.
|
82 | *
|
83 | * Any actions performed on the clone won’t mutate the original set.
|
84 | */
|
85 | clone(): regenerate;
|
86 |
|
87 | /**
|
88 | * Returns a regular expression that matches all the symbols
|
89 | * mapped to the code points within the set.
|
90 | *
|
91 | * @param flags The `flags` parameter to be passed to the regular expression.
|
92 | */
|
93 | toRegExp(flags?: string): RegExp;
|
94 |
|
95 | /**
|
96 | * Returns a string representing (part of) a regular expression that matches
|
97 | * all the symbols mapped to the code points within the set.
|
98 | *
|
99 | * @param options The optional `options` object
|
100 | */
|
101 | toString(options?: regenerate.ToStringOptions): string;
|
102 |
|
103 | /**
|
104 | * Returns a sorted array of unique code points in the set.
|
105 | *
|
106 | * @alias valueOf
|
107 | */
|
108 | toArray(): number[];
|
109 |
|
110 | /**
|
111 | * Returns a sorted array of unique code points in the set.
|
112 | *
|
113 | * @alias toArray
|
114 | */
|
115 | valueOf(): number[];
|
116 |
|
117 | /** A string representing the semantic version number. */
|
118 | static readonly version: string;
|
119 | }
|
120 |
|
121 | declare namespace regenerate {
|
122 | interface ToStringOptions {
|
123 | |
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 | readonly bmpOnly?: boolean | undefined;
|
131 |
|
132 | |
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 |
|
140 |
|
141 |
|
142 | readonly hasUnicodeFlag?: boolean | undefined;
|
143 | }
|
144 | }
|