Passed
Pull Request — master (#159)
by Mathieu
01:47
created

server/src/Infrastructure/Common/Utils/ArrayUtils.ts   A

Complexity

Total Complexity 6
Complexity/F 1.5

Size

Lines of Code 15
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 6
mnd 2
bc 2
fnc 4
bpm 0.5
cpm 1.5
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A ArrayUtils.range 0 10 3
1
export class ArrayUtils {
2
  public static range(start: number, end: number, step: number = 1) {
3
    function* generateRange() {
4
      let x = start - step;
5
      while(x <= end - step) {
6
        yield x += step;
7
      }
8
    }
9
10
    return {
11
      [Symbol.iterator]: generateRange
12
    };
13
  }
14
}
15