Passed
Push — main ( ef757f...394b21 )
by Andrii
03:47
created

__sandbox__/atom.test.ts   A

Complexity

Total Complexity 2
Complexity/F 0

Size

Lines of Code 22
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 17
mnd 2
bc 2
fnc 0
dl 0
loc 22
rs 10
bpm 0
cpm 0
noi 0
c 0
b 0
f 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
})