@nyaomaru/divider 1.9.14 → 1.9.15
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.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -49,7 +49,7 @@ type HasFlattenOption<TOptions extends DividerInferredOptions> = TOptions extend
|
|
|
49
49
|
readonly flatten?: infer Flag;
|
|
50
50
|
} ? Flag extends true ? true : false : false;
|
|
51
51
|
type DividerResult<T extends DividerInput, TOptions extends DividerInferredOptions = DividerEmptyOptions> = T extends StringInput ? DividerStringResult : HasFlattenOption<TOptions> extends true ? DividerStringResult : DividerArrayResult;
|
|
52
|
-
type ExtractedDividerOptions<TArgs extends
|
|
52
|
+
type ExtractedDividerOptions<TArgs extends DividerArgs> = TArgs extends readonly [...infer _Rest, infer Last] ? Last extends DividerOptions ? Last : DividerEmptyOptions : DividerEmptyOptions;
|
|
53
53
|
type DividerLoopOptions = DividerOptions & {
|
|
54
54
|
/** Starting position for the division (0-based) */
|
|
55
55
|
startOffset?: number;
|
|
@@ -67,6 +67,8 @@ type NumericSeparator = number;
|
|
|
67
67
|
type StringSeparator = string;
|
|
68
68
|
type DividerSeparator = NumericSeparator | StringSeparator;
|
|
69
69
|
type DividerSeparators = DividerSeparator[];
|
|
70
|
+
type DividerArg = DividerSeparator | DividerOptions;
|
|
71
|
+
type DividerArgs = readonly DividerArg[];
|
|
70
72
|
|
|
71
73
|
/**
|
|
72
74
|
* Main divider function that splits input based on numeric positions or string delimiters.
|
|
@@ -80,7 +82,7 @@ type DividerSeparators = DividerSeparator[];
|
|
|
80
82
|
* @param args - Array of separators (numbers/strings) and optional options object
|
|
81
83
|
* @returns Divided string segments based on input type and options
|
|
82
84
|
*/
|
|
83
|
-
declare function divider<T extends DividerInput, const TArgs extends readonly
|
|
85
|
+
declare function divider<T extends DividerInput, const TArgs extends readonly DividerArg[]>(input: T, ...args: TArgs): DividerResult<T, ExtractedDividerOptions<TArgs>>;
|
|
84
86
|
|
|
85
87
|
/**
|
|
86
88
|
* Extracts the first segment after dividing the input using specified separators.
|
|
@@ -188,4 +190,4 @@ declare function emailDivider(input: string, options?: EmailDividerOptions): Div
|
|
|
188
190
|
*/
|
|
189
191
|
declare function pathDivider(input: string, options?: PathDividerOptions): DividerStringResult;
|
|
190
192
|
|
|
191
|
-
export { type DividerArrayResult, type DividerEmptyOptions, type DividerExcludeMode, type DividerInferredOptions, type DividerInput, type DividerLoopEmptyOptions, type DividerLoopOptions, type DividerLoopOptionsLike, type DividerOptions, type DividerResult, type DividerSeparator, type DividerSeparators, type DividerStringResult, type ExtractedDividerOptions, type NumericSeparator, type StringArrayInput, type StringInput, type StringSeparator, csvDivider, divider, dividerFirst, dividerLast, dividerLoop, dividerNumberString, emailDivider, pathDivider };
|
|
193
|
+
export { type DividerArg, type DividerArgs, type DividerArrayResult, type DividerEmptyOptions, type DividerExcludeMode, type DividerInferredOptions, type DividerInput, type DividerLoopEmptyOptions, type DividerLoopOptions, type DividerLoopOptionsLike, type DividerOptions, type DividerResult, type DividerSeparator, type DividerSeparators, type DividerStringResult, type ExtractedDividerOptions, type NumericSeparator, type StringArrayInput, type StringInput, type StringSeparator, csvDivider, divider, dividerFirst, dividerLast, dividerLoop, dividerNumberString, emailDivider, pathDivider };
|
package/dist/index.d.ts
CHANGED
|
@@ -49,7 +49,7 @@ type HasFlattenOption<TOptions extends DividerInferredOptions> = TOptions extend
|
|
|
49
49
|
readonly flatten?: infer Flag;
|
|
50
50
|
} ? Flag extends true ? true : false : false;
|
|
51
51
|
type DividerResult<T extends DividerInput, TOptions extends DividerInferredOptions = DividerEmptyOptions> = T extends StringInput ? DividerStringResult : HasFlattenOption<TOptions> extends true ? DividerStringResult : DividerArrayResult;
|
|
52
|
-
type ExtractedDividerOptions<TArgs extends
|
|
52
|
+
type ExtractedDividerOptions<TArgs extends DividerArgs> = TArgs extends readonly [...infer _Rest, infer Last] ? Last extends DividerOptions ? Last : DividerEmptyOptions : DividerEmptyOptions;
|
|
53
53
|
type DividerLoopOptions = DividerOptions & {
|
|
54
54
|
/** Starting position for the division (0-based) */
|
|
55
55
|
startOffset?: number;
|
|
@@ -67,6 +67,8 @@ type NumericSeparator = number;
|
|
|
67
67
|
type StringSeparator = string;
|
|
68
68
|
type DividerSeparator = NumericSeparator | StringSeparator;
|
|
69
69
|
type DividerSeparators = DividerSeparator[];
|
|
70
|
+
type DividerArg = DividerSeparator | DividerOptions;
|
|
71
|
+
type DividerArgs = readonly DividerArg[];
|
|
70
72
|
|
|
71
73
|
/**
|
|
72
74
|
* Main divider function that splits input based on numeric positions or string delimiters.
|
|
@@ -80,7 +82,7 @@ type DividerSeparators = DividerSeparator[];
|
|
|
80
82
|
* @param args - Array of separators (numbers/strings) and optional options object
|
|
81
83
|
* @returns Divided string segments based on input type and options
|
|
82
84
|
*/
|
|
83
|
-
declare function divider<T extends DividerInput, const TArgs extends readonly
|
|
85
|
+
declare function divider<T extends DividerInput, const TArgs extends readonly DividerArg[]>(input: T, ...args: TArgs): DividerResult<T, ExtractedDividerOptions<TArgs>>;
|
|
84
86
|
|
|
85
87
|
/**
|
|
86
88
|
* Extracts the first segment after dividing the input using specified separators.
|
|
@@ -188,4 +190,4 @@ declare function emailDivider(input: string, options?: EmailDividerOptions): Div
|
|
|
188
190
|
*/
|
|
189
191
|
declare function pathDivider(input: string, options?: PathDividerOptions): DividerStringResult;
|
|
190
192
|
|
|
191
|
-
export { type DividerArrayResult, type DividerEmptyOptions, type DividerExcludeMode, type DividerInferredOptions, type DividerInput, type DividerLoopEmptyOptions, type DividerLoopOptions, type DividerLoopOptionsLike, type DividerOptions, type DividerResult, type DividerSeparator, type DividerSeparators, type DividerStringResult, type ExtractedDividerOptions, type NumericSeparator, type StringArrayInput, type StringInput, type StringSeparator, csvDivider, divider, dividerFirst, dividerLast, dividerLoop, dividerNumberString, emailDivider, pathDivider };
|
|
193
|
+
export { type DividerArg, type DividerArgs, type DividerArrayResult, type DividerEmptyOptions, type DividerExcludeMode, type DividerInferredOptions, type DividerInput, type DividerLoopEmptyOptions, type DividerLoopOptions, type DividerLoopOptionsLike, type DividerOptions, type DividerResult, type DividerSeparator, type DividerSeparators, type DividerStringResult, type ExtractedDividerOptions, type NumericSeparator, type StringArrayInput, type StringInput, type StringSeparator, csvDivider, divider, dividerFirst, dividerLast, dividerLoop, dividerNumberString, emailDivider, pathDivider };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyaomaru/divider",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.9.
|
|
4
|
+
"version": "1.9.15",
|
|
5
5
|
"description": "To divide string or string[] with a given separator",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@types/jest": "^30.0.0",
|
|
40
40
|
"@types/node": "^22.15.12",
|
|
41
41
|
"bun-types": "^1.2.21",
|
|
42
|
-
"eslint": "^9.
|
|
43
|
-
"eslint-config-prettier": "^10.1.
|
|
44
|
-
"eslint-plugin-prettier": "^5.4
|
|
45
|
-
"jest": "^30.
|
|
42
|
+
"eslint": "^9.39.1",
|
|
43
|
+
"eslint-config-prettier": "^10.1.8",
|
|
44
|
+
"eslint-plugin-prettier": "^5.5.4",
|
|
45
|
+
"jest": "^30.2.0",
|
|
46
46
|
"prettier": "^3.5.3",
|
|
47
|
-
"ts-jest": "^29.
|
|
47
|
+
"ts-jest": "^29.4.5",
|
|
48
48
|
"ts-node": "^10.9.2",
|
|
49
49
|
"tsup": "^8.4.0",
|
|
50
50
|
"tsx": "^4.19.4",
|