Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@vect/object-mapper

hoyeungw101MIT0.8.6

Iterate through an object, with returned value or without returned value, or iterate using generator.

array, vector, matrix, object

readme

@vect/object-mapper

npm version npm download monthly npm download total npm dependents npm license pp install size github commit last github commit total

Util for array

Install

$ npm install @vect/object-mapper

Functions

  • mapper map object values and return a new object
  • mutate map object values and return the object itself
  • mapKeys map object keys and return a new object
  • mapEntries map object entries and return a new object

Usage

import { mapper, mutate, mapKeys, mapEntries } from '@vect/object-mapper'

const ob = {
  AMEE: 'Red Planet',
  AMP: 'Avatar',
  Maximilian: 'The Black Hole',
  Terminatrix: 'Terminator 3',
}

mapper(ob, value => value.length)
mapKeys(ob, key => key.slice(0, 4))
mapEntries(ob, ([key, value], i) => [`${key}_${i}`, value.length])
mutate(ob, value => value.length)

Meta

LICENSE (MIT)