Components and utilities for the modern web
Javascript Utilities

ObjectMap

objectMap iterates over an object and returns an array. It uses Array.prototype.map under the hood to return the array.

Installation

First, make sure you install Splendid UI.

npm install splendid-ui

Then import objectMap into your project.

import { objectMap } from 'splendid-ui/utils'

Usage

objectMap takes in two arguments:

  • the object to loop over
  • the callback to execute
const array = objectMap(object, ({ key, value }) => {
  // Do what you want
})

That’s it!

Like what you're seeing?

I'm on a quest to make web development extremely easy — by building components and utilities that will help all of us build better apps at a much faster pace.

I'd like to send you an update when I release something new in Splendid UI. If you want to be updated, please leave your email address below.

Powered by Buttondown