src/io/ArrayC.ts   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 14
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 80%

Importance

Changes 0
Metric Value
wmc 1
eloc 12
mnd 1
bc 1
fnc 0
dl 0
loc 14
ccs 4
cts 5
cp 0.8
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 10
1 1
import {identity} from 'fp-ts/lib/function';
2 1
import * as t from 'io-ts';
3
4 84
const is = <A>() => (u: unknown): u is Array<A> => u instanceof Array;
5
6 84
export const ArrayC = <A = never>() => new t.Type<Array<A>>(
7
  'Array',
8
  is<A>(),
9
  (u, c) => is<A>()(u)
10
    ? t.success(u)
11
    : t.failure(u, c),
12
  identity
13
);
14