map-object

A method for mapping dict objects as if it were an array


License
MIT
Install
pip install map-object==1.1.0

Documentation

Map Object

A python implementation of the map-obj function

Installation

pip install map_object

Usage

from map_object import mapObject

def mapper (key, value, source):
  return [value, ley]

newObject = mapObject({'foo'='bar'}, mapper);
# => {bar: 'foo'}

API

mapObject(source, mapper)

source

Type: Object

Source object to copy properties from.

mapper

Type: Function

Mapping function.

  • It has signature mapper(sourceKey, sourceValue, source)
  • It must return a two item array: [targetKey, targetValue].

License

MIT