topics/queue-implementation/index.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1

Size

Lines of Code 17
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

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

4 Functions

Rating   Name   Duplication   Size   Complexity  
A Queue.enqueue 0 3 1
A Queue.peek 0 3 1
A Queue.dequeue 0 3 1
A Queue.constructor 0 3 1
1
class Queue {
2
    // put your code here to address problems
3
    constructor() {
4
        this.data = [];
5
    }
6
    enqueue(record) {
7
        this.data.unshift(record);
8
    }
9
    dequeue() {
10
        return this.data.pop();
11
    }
12
    peek() {
13
        return this.data;
14
    }
15
}
16
17
module.exports = Queue;