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