helper/helper.js   A
last analyzed

Complexity

Total Complexity 7
Complexity/F 1.17

Size

Lines of Code 40
Function Count 6

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 18
mnd 1
bc 1
fnc 6
dl 0
loc 40
bpm 0.1666
cpm 1.1666
noi 0
c 0
b 0
f 0
rs 10
1
const converter = {
2
	// convert list of object to an array
3
    O2A: function(data){
4
		 const converted = []
5
	 	//LOOPING EACH CHILD AND PUSHING TO ARRAY
6
         for (const [key, value] of Object.entries(data.val())) {
7
                   value['object_key'] = key;
8
                   converted.push(value);
9
          } 
10
		  return converted;
11
    },
12
13
	// Reverse array supplied
14
    ReverseO2A: function(data){
15
			  return data.reverse();
16
    },
17
18
    // Return the first Item in the array
19
   FirstO2A : function(data){
20
         return data[0];
21
     },
22
23
   // Return the last Item in the array
24
   LastO2A : function(data){
25
         return data.slice(-1)[0];
26
     },
27
28
     // Return N number of items in array
29
  	GetNO2A: function(data, number){
30
         return data.slice(0, number);
31
     },
32
33
    // get total count of data in array
34
     CountO2A:function(data){
35
       return  data.length
36
     }
37
38
}
39
40
export default converter;