@kakasoo/proto-typescript
Advanced tools
Comparing version 1.28.1 to 1.28.2
@@ -116,4 +116,4 @@ import { ArrayType, StringType } from '../types'; | ||
*/ | ||
function split<Container extends string, Splitter extends string = '', Limit extends number = 0>(container: Container, splitter: Splitter, limit?: Limit): StringType.Split<Container, Splitter, Limit>; | ||
function split<Container extends string, Splitter extends string = '', Limit extends number = ArrayType.Length<StringType.Split<Container, Splitter>>>(container: Container, splitter: Splitter, limit?: Limit): StringType.Split<Container, Splitter, Limit>; | ||
} | ||
//# sourceMappingURL=string.prototype.d.ts.map |
@@ -66,3 +66,6 @@ import { NeverType } from './never.type'; | ||
*/ | ||
export type Shift<T extends ReadonlyOrNot<any[]>> = T extends [infer F, ...infer Rest] ? Rest : []; | ||
export type Shift<T extends ReadonlyOrNot<any[]>, N extends number> = T extends [ | ||
...infer F extends NTuple<N>, | ||
...infer Rest | ||
] ? Rest : []; | ||
/** | ||
@@ -69,0 +72,0 @@ * Unshift<[1, 2, 3], 4> // [4,1,2,3] |
@@ -54,10 +54,14 @@ import { Conditional } from './arithmetic.type'; | ||
/** | ||
* type answer = SplitMap<['aaa', 'bab'], 'a'>; // ["", "", "", "b", "b"] | ||
* ```ts | ||
* SplitMap<['aaa', 'bab'], 'a'>; // ["", "", "", "b", "b"] | ||
* ``` | ||
*/ | ||
export type SplitMap<Containers extends string[], Splitter extends string = ''> = Containers extends [] ? [] : Containers extends [infer First extends string, ...infer Rest extends string[]] ? [..._Split<First, Splitter>, ...SplitMap<Rest, Splitter>] : []; | ||
/** | ||
* type answer1 = SplitByManySplitter<['Hello-bbb_ccc'], [' ', '-', '_']>; | ||
* type answer2 = StringType.SplitByManySplitter<['Hello world'], ['_', ' ', '.', '-', '/']>; | ||
* type answer3 = StringType.SplitByManySplitter<['Hello world-kakasoo'], ['_', ' ', '.', '-', '/']>; | ||
* type answer4 = StringType.SplitByManySplitter<['Hello world, my name-is_kakasoo', 'ha ha ha'], ['_', ' ', ',', '.', '-', '/']>; | ||
* ```ts | ||
* SplitByManySplitter<['Hello-bbb_ccc'], [' ', '-', '_']>; | ||
* StringType.SplitByManySplitter<['Hello world'], ['_', ' ', '.', '-', '/']>; | ||
* StringType.SplitByManySplitter<['Hello world-kakasoo'], ['_', ' ', '.', '-', '/']>; | ||
* StringType.SplitByManySplitter<['Hello world, my name-is_kakasoo', 'ha ha ha'], ['_', ' ', ',', '.', '-', '/']>; | ||
* ``` | ||
*/ | ||
@@ -64,0 +68,0 @@ export type SplitByManySplitter<Containers extends string[], Splitters extends readonly string[] = []> = Splitters extends [] ? Containers : Splitters extends [infer FirstSplitter extends string, ...infer RestSplitters extends string[]] ? SplitMap<Containers, FirstSplitter> extends [infer FirstToken extends string] ? SplitByManySplitter<[FirstToken], RestSplitters> : SplitMap<Containers, FirstSplitter> extends [ |
{ | ||
"name": "@kakasoo/proto-typescript", | ||
"version": "1.28.1", | ||
"version": "1.28.2", | ||
"publishConfig": { | ||
"access": "public" | ||
"access": "public", | ||
"registry": "https://registry.npmjs.org/" | ||
}, | ||
@@ -19,3 +20,4 @@ "description": "Utility types and implementations based on JavaScript prototypes.", | ||
"test:watch": "jest --watch", | ||
"test:cov": "jest --coverage" | ||
"test:cov": "jest --coverage", | ||
"deploy": "npm publish" | ||
}, | ||
@@ -22,0 +24,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
164063
1849