map-to-obj
ES2015 Map to plain object.
Last updated 10 years ago by rem .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install map-to-obj 
SYNC missed versions from official npm registry.

map-to-obj

NPM version NPM downloads Build Status donate

Install

yarn add map-to-obj

Usage

const mapToObj = require('map-to-obj')

const map = new Map([
  ['foo', 123],
  ['bar', 'hello']
])
map.set('foo', '123')

mapToObj(map)
//=> 
{
  foo: 123,
  bar: 'hello'
}

Note: Don't use object as key, otherwise you will get [object Object] in result object.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

map-to-obj © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoistian.com · GitHub @egoist · Twitter @rem_rin_rin

Current Tags

  • 0.2.0                                ...           latest (10 years ago)

1 Versions

  • 0.2.0                                ...           10 years ago
Maintainers (1)
Downloads
Total 4
Today 0
This Week 0
This Month 4
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE