Splendid UI
Components and utilities for the modern web
-->
objectMap
iterates over an object and returns an array. It uses Array.prototype.map
under the hood to return the array.
First, make sure you install Splendid UI.
npm install splendid-ui
Then import objectMap
into your project.
import { objectMap } from 'splendid-ui/utils'
objectMap
takes in two arguments:
object
to loop overcallback
to executeconst array = objectMap(object, ({ key, value }) => {
// Do what you want
})
That’s it!