$ npm install map-to-obj
yarn add map-to-obj
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.
git checkout -b my-new-featuregit commit -am 'Add some feature'git push origin my-new-featuremap-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
© 2010 - cnpmjs.org x YWFE | Home | YWFE