1.0.0 • Published 5 years ago

functional-map v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

functional-map

Build Status code style: prettier

Extend javascript's Map object with higher-order functions.

Includes .map, .filter (which return a new Map) and .reduce methods.

import Map from 'functional-map'

const nmap = new Map([[1, 2], [2, 3], [3, 4]])
    .filter((value, key) => key < 3)
    .map(value => value.toString())
    .reduce((acc, current, key) => ({ ...acc, [key]: current }), {})

Install

yarn add functional-map

or

npm i functional-map

Import

// es2015
import Map from 'functional-map'

// commonJS
const Map = require('functional-map').default