Total Complexity | 2 |
Complexity/F | 0 |
Lines of Code | 22 |
Function Count | 0 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { Cut, Strip, UnionToIntersection } from "src/ts-swiss.types" |
||
2 | |||
3 | it("stripper", () => { |
||
4 | type C1 = `${"visible-print"}-${"inline"|"block"|"inline-block"}`|`col${""|"-y"|"-x"}`|"display" |
||
5 | type Pairs<classes extends string> = { |
||
6 | [root in Strip<classes, "-">]: { |
||
7 | [m1 in Merge<root, `${root}-${Strip<Cut<classes, `${root}-`, true>, "-">}`>]: true |
||
8 | } |
||
9 | } |
||
10 | |||
11 | type Merge<Base extends string, Result extends string> = [Result] extends [never] ? Base : [UnionToIntersection<Result>] extends [never] ? Base : Result |
||
12 | |||
13 | const checks: Record<string, Pairs<C1>> = { |
||
14 | "x": { |
||
15 | visible: {"visible-print": true}, |
||
16 | col: {col: true}, |
||
17 | display: {display: true} |
||
18 | } |
||
19 | } |
||
20 | |||
21 | expect(checks).toBeInstanceOf(Object) |
||
22 | }) |