@clerc/parser 1.0.0-beta.19 → 1.0.0-beta.20

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/dist/index.d.ts CHANGED
@@ -29,7 +29,7 @@ type FlagDefaultValue<T = unknown> = T | FlagDefaultValueFunction<T>;
29
29
  *
30
30
  * @template T The target type.
31
31
  */
32
- interface FlagTypeFunction<T = unknown> {
32
+ interface TypeFunction<T = unknown> {
33
33
  (value: string): T;
34
34
  /**
35
35
  * Optional display name for the type, useful in help output.
@@ -46,7 +46,7 @@ interface FlagTypeFunction<T = unknown> {
46
46
  * @returns true to stop parsing, false to continue
47
47
  */
48
48
  type IgnoreFunction = (type: typeof KNOWN_FLAG | typeof UNKNOWN_FLAG | typeof PARAMETER, arg: string) => boolean;
49
- type FlagType<T = unknown> = FlagTypeFunction<T> | readonly [FlagTypeFunction<T>];
49
+ type FlagType<T = unknown> = TypeFunction<T> | readonly [TypeFunction<T>];
50
50
  interface BaseFlagOptions<T extends FlagType = FlagType> {
51
51
  /**
52
52
  * The type constructor or a function to convert the string value.
@@ -153,7 +153,7 @@ type InferFlags<T extends FlagsDefinition> = Prettify<_InferFlags<T>>;
153
153
  * The display name will be formatted as "value1 | value2 | ..." for help output.
154
154
  *
155
155
  * @param values - Array of allowed string values
156
- * @returns A FlagTypeFunction that validates and returns the input value
156
+ * @returns A TypeFunction that validates and returns the input value
157
157
  * @throws {Error} If the value is not in the allowed values list
158
158
  *
159
159
  * @example
@@ -162,25 +162,25 @@ type InferFlags<T extends FlagsDefinition> = Prettify<_InferFlags<T>>;
162
162
  * // Help output will show: json | yaml | xml
163
163
  * ```
164
164
  */
165
- declare function Enum<T extends string>(...values: T[]): FlagTypeFunction<T>;
165
+ declare function Enum<T extends string>(...values: T[]): TypeFunction<T>;
166
166
  /**
167
167
  * Creates a range type function that validates the input is a number within the specified range.
168
168
  *
169
169
  * @param min - The minimum acceptable value (inclusive)
170
170
  * @param max - The maximum acceptable value (inclusive)
171
- * @returns A FlagTypeFunction that validates the input value
171
+ * @returns A TypeFunction that validates the input value
172
172
  * @throws {Error} If the value is not a number or is outside the specified range
173
173
  */
174
- declare function Range(min: number, max: number): FlagTypeFunction<number>;
174
+ declare function Range(min: number, max: number): TypeFunction<number>;
175
175
  /**
176
176
  * Creates a regex type function that validates the input against the provided pattern.
177
177
  *
178
178
  * @param pattern - The regular expression pattern to validate against
179
179
  * @param description - Optional description for display purposes
180
- * @returns A FlagTypeFunction that validates the input value
180
+ * @returns A TypeFunction that validates the input value
181
181
  * @throws {Error} If the value does not match the regex pattern
182
182
  */
183
- declare function Regex(pattern: RegExp, description?: string): FlagTypeFunction<string>;
183
+ declare function Regex(pattern: RegExp, description?: string): TypeFunction<string>;
184
184
  //#endregion
185
185
  //#region src/parse.d.ts
186
186
  declare const DOUBLE_DASH = "--";
@@ -190,4 +190,4 @@ declare function createParser<T extends FlagsDefinition>(options?: ParserOptions
190
190
  };
191
191
  declare const parse: <T extends FlagsDefinition>(args: string[], options?: ParserOptions<T>) => ParsedResult<InferFlags<T>>;
192
192
  //#endregion
193
- export { BaseFlagOptions, DOUBLE_DASH, Enum, FlagDefaultValue, FlagDefaultValueFunction, FlagDefinitionValue, FlagOptions, FlagType, FlagTypeFunction, FlagsDefinition, IgnoreFunction, InferFlags, InvalidSchemaError, KNOWN_FLAG, MissingRequiredFlagError, ObjectInputType, PARAMETER, ParsedResult, ParserOptions, Range, RawInputType, Regex, UNKNOWN_FLAG, createParser, parse };
193
+ export { BaseFlagOptions, DOUBLE_DASH, Enum, FlagDefaultValue, FlagDefaultValueFunction, FlagDefinitionValue, FlagOptions, FlagType, FlagsDefinition, IgnoreFunction, InferFlags, InvalidSchemaError, KNOWN_FLAG, MissingRequiredFlagError, ObjectInputType, PARAMETER, ParsedResult, ParserOptions, Range, RawInputType, Regex, TypeFunction, UNKNOWN_FLAG, createParser, parse };
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ var MissingRequiredFlagError = class extends Error {
19
19
  * The display name will be formatted as "value1 | value2 | ..." for help output.
20
20
  *
21
21
  * @param values - Array of allowed string values
22
- * @returns A FlagTypeFunction that validates and returns the input value
22
+ * @returns A TypeFunction that validates and returns the input value
23
23
  * @throws {Error} If the value is not in the allowed values list
24
24
  *
25
25
  * @example
@@ -41,7 +41,7 @@ function Enum(...values) {
41
41
  *
42
42
  * @param min - The minimum acceptable value (inclusive)
43
43
  * @param max - The maximum acceptable value (inclusive)
44
- * @returns A FlagTypeFunction that validates the input value
44
+ * @returns A TypeFunction that validates the input value
45
45
  * @throws {Error} If the value is not a number or is outside the specified range
46
46
  */
47
47
  function Range(min, max) {
@@ -58,7 +58,7 @@ function Range(min, max) {
58
58
  *
59
59
  * @param pattern - The regular expression pattern to validate against
60
60
  * @param description - Optional description for display purposes
61
- * @returns A FlagTypeFunction that validates the input value
61
+ * @returns A TypeFunction that validates the input value
62
62
  * @throws {Error} If the value does not match the regex pattern
63
63
  */
64
64
  function Regex(pattern, description) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clerc/parser",
3
- "version": "1.0.0-beta.19",
3
+ "version": "1.0.0-beta.20",
4
4
  "author": "Ray <i@mk1.io> (https://github.com/so1ve)",
5
5
  "type": "module",
6
6
  "description": "Clerc parser",
@@ -56,6 +56,6 @@
56
56
  "nopt": "^9.0.0",
57
57
  "type-flag": "^4.0.3",
58
58
  "yargs-parser": "^22.0.0",
59
- "@clerc/utils": "1.0.0-beta.19"
59
+ "@clerc/utils": "1.0.0-beta.20"
60
60
  }
61
61
  }