1.0.0 • Published 8 years ago

map-struct v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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