src/core.ts   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 4

Size

Lines of Code 21
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 16
mnd 3
bc 3
fnc 1
dl 0
loc 21
ccs 11
cts 11
cp 1
rs 10
bpm 3
cpm 4
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A core.ts ➔ sortRecursively 0 15 4
1
import { SortOptions } from './types';
2 1
import { isPrimitive, isNonSortableObject, isObject } from './type-guards';
3 1
import { sortArray } from './array-sorter';
4 1
import { sortObject } from './object-sorter';
5
6 1
export function sortRecursively<T>(data: T, options: SortOptions): T {
7 1660
  if (Array.isArray(data)) {
8 72
    return sortArray(data, options) as T;
9
  }
10
11 1588
  if (isPrimitive(data) || isNonSortableObject(data)) {
12 186
    return data;
13
  }
14
15 1401
  if (isObject(data)) {
16 1398
    return sortObject(data, options) as T;
17
  }
18
19 3
  return data;
20
}
21