map-struct

1.0.0 • Public • Published

map-struct Build Status

Map values in an observ-struct

Install

$ npm install --save map-struct

Usage

var map = require('map-struct')
var Struct = require('observ-struct')
 
var numbers = Struct({
  a: 1,
  b: 2
})
 
map(numbers, function (value, key, struct) {
  return value * 2
})
//=> {a: 2, b: 4}

API

map(struct, fn) -> object

struct

Required
Type: function

An observ-struct.

fn

Type: function
Arguments: value, key, struct

A function to call with the value/key pairs and the original object. Each return value is stored at the key in the new object.

License

MIT © Ben Drucker

Package Sidebar

Install

npm i map-struct

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • bendrucker