@typescriptprime/parsing 1.1.0-build.1 → 1.1.0
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 +3 -0
- package/dist/postprocessing/index.d.ts +13 -0
- package/dist/preprocessing/index.d.ts +11 -0
- package/dist/types.d.ts +9 -0
- package/package.json +1 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { JSONValue, IParsingOptions } from '../types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Parses a list of CLI-style arguments into a structured options object and positional arguments.
|
|
4
|
+
*
|
|
5
|
+
* @typeParam I - The shape of the options object produced from the parsed arguments.
|
|
6
|
+
* @param Args - The raw argument tokens, including option flags and positional values.
|
|
7
|
+
* @param FuncOptions - Configuration for post-processing behavior, such as the naming convention transformer.
|
|
8
|
+
* @returns A promise resolving to an object containing the parsed options and remaining positional arguments.
|
|
9
|
+
*/
|
|
10
|
+
export declare function PostProcessing<I extends JSONValue>(Args: string[], FuncOptions?: IParsingOptions): Promise<{
|
|
11
|
+
Options: I;
|
|
12
|
+
Positional: string[];
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as Process from 'node:process';
|
|
2
|
+
type DropFirstANDTwo<T extends readonly unknown[]> = T extends readonly [unknown, unknown, ...infer Tail] ? Tail : [];
|
|
3
|
+
type DropFirst<T extends readonly unknown[]> = T extends readonly [unknown, ...infer Tail] ? Tail : [];
|
|
4
|
+
/**
|
|
5
|
+
* Returns a filtered `process.argv` with only options and their values.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} Args - A value of `process.argv`.
|
|
8
|
+
* @returns A filtered `process.argv` with only options and their values.
|
|
9
|
+
*/
|
|
10
|
+
export declare function PreProcessing<Args extends typeof Process.argv>(Args: Args): DropFirstANDTwo<Args> | DropFirst<Args>;
|
|
11
|
+
export {};
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type JSONPrimitive = string | number | boolean | null;
|
|
2
|
+
export interface JSONObject {
|
|
3
|
+
[key: string]: JSONValue;
|
|
4
|
+
}
|
|
5
|
+
export type JSONArray = Array<JSONValue>;
|
|
6
|
+
export type JSONValue = JSONPrimitive | JSONObject | JSONArray;
|
|
7
|
+
export interface IParsingOptions {
|
|
8
|
+
NamingConvention?: ((PropertyName: string) => string) | ((PropertyName: string) => Promise<string>);
|
|
9
|
+
}
|
package/package.json
CHANGED