src/generators/pick.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 16
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 5
mnd 0
bc 0
fnc 1
dl 0
loc 16
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A PickGenerator.generate 0 5 1
1
import Generator from './Base';
2
3
/**
4
 * Pick random item from the array.
5
 * @param {array} options list of available options
6
 * @returns {any} item
7
 * @requires int
8
 * @generator
9
 */
10
export default class PickGenerator extends Generator {
11
    generate(array) {
12
        const index = this.fatum.int(0, array.length - 1);
13
14
        return array[index];
15
    }
16
}
17