filter-object-of-objects
v1.0.4
Published
Sometimes what if you received an object of objects rather than array of objects from backend as a response, so how you will render that object of objects data using iterator of loop ? Finally, with ES2017, it's official now! We have 3 variations to conve
Downloads
7
Maintainers
Readme
Converting Object to an Array
Problem
Sometimes what if you received an object of objects rather than array of objects from backend as a response, so how you will render that object of objects data using iterator of loop ?
Solution
Finally, with ES2017, it's official now! We have 3 variations to convert an Object to an Array 🎊
The array has an array of methods (sorry, bad pun 😝). So by converting the object into an array, you have access to all of that. Woohoo 🥳
Usage
import convertToArray from 'filter-object-of-objects';
const numbers = {
one: 1,
two: 2,
};
// passing an object of objects will return the array of objects
convertToArray(numbers);
// [
// { key: 'one', value: 1 },
// { key: 'two', value: 2 },
// ]