Skip to content

Commit d6e0d03

Browse files
authored
Object to array conversion
Added a function to convert an object to an array in JS.
1 parent 74d876d commit d6e0d03

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,11 @@ function array_frequency(arr) {
6565
return freq_obj;
6666
}
6767

68-
export { is_array, head, tail, in_array, array_filter, array_chunk, array_frequency };
68+
function object_to_array(obj){
69+
let temp=[]
70+
const entries = Object.entries(obj)
71+
entries.forEach(ent => temp.push(ent[1]))
72+
return temp;
73+
}
74+
75+
export { is_array, head, tail, in_array, array_filter, array_chunk, array_frequency,object_to_array };

0 commit comments

Comments
 (0)