@ptolemy2002/rgx 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -143,7 +143,7 @@ Escapes special regex characters in the given string and brands the result as a
143
143
 
144
144
  ### resolveRGXToken
145
145
  ```typescript
146
- function resolveRGXToken(token: RGXToken): string
146
+ function resolveRGXToken(token: RGXToken): ValidRegexString
147
147
  ```
148
148
 
149
149
  Resolves an RGX token to a string. No-op tokens resolve to an empty string, literal tokens are included as-is (wrapped in a non-capturing group), native tokens are converted to strings and escaped, convertible tokens are converted using their `toRgx` method and then resolved recursively, and arrays of tokens are resolved as unions of their resolved elements (placed in a non-capturing group).
@@ -152,11 +152,11 @@ Resolves an RGX token to a string. No-op tokens resolve to an empty string, lite
152
152
  - `token` (`RGXToken`): The RGX token to resolve.
153
153
 
154
154
  #### Returns
155
- - `string`: The resolved string representation of the RGX token.
155
+ - `ValidRegexString`: The resolved string representation of the RGX token. This is guaranteed to be a valid regex string, as convertible tokens are validated to only produce valid regex strings or arrays of valid regex strings.
156
156
 
157
157
  ### rgxConcat
158
158
  ```typescript
159
- function rgxConcat(tokens: RGXToken[]): string
159
+ function rgxConcat(tokens: RGXToken[]): ValidRegexString
160
160
  ```
161
161
 
162
162
  A helper function that resolves an array of RGX tokens and concatenates their resolved string representations together. This is useful for cases where you want to concatenate multiple tokens without creating a union between them.
@@ -165,7 +165,7 @@ A helper function that resolves an array of RGX tokens and concatenates their re
165
165
  - `tokens` (`RGXToken[]`): The array of RGX tokens to resolve and concatenate.
166
166
 
167
167
  #### Returns
168
- - `string`: The concatenated string representation of the resolved RGX tokens.
168
+ - `ValidRegexString`: The concatenated string representation of the resolved RGX tokens. This is guaranteed to be a valid regex string, as it is composed of the resolved forms of RGX tokens, which are all valid regex strings.
169
169
 
170
170
  ### rgx
171
171
  ```typescript
package/dist/index.d.ts CHANGED
@@ -21,6 +21,6 @@ export declare function rgxTokenType(value: RGXToken): RGXTokenType;
21
21
  export declare function rgxTokenFromType<T extends RGXTokenType>(type: T, value: RGXToken): RGXTokenFromType<T>;
22
22
  export declare function isValidRegex(value: string): value is ValidRegexString;
23
23
  export declare function escapeRegex(value: string): ValidRegexString;
24
- export declare function resolveRGXToken(token: RGXToken): string;
25
- export declare function rgxConcat(tokens: RGXToken[]): string;
24
+ export declare function resolveRGXToken(token: RGXToken): ValidRegexString;
25
+ export declare function rgxConcat(tokens: RGXToken[]): ValidRegexString;
26
26
  export default function rgx(strings: TemplateStringsArray, ...tokens: RGXToken[]): RegExp;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/rgx",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",