{"name":"map-obj","version":"1.0.1","description":"Map object keys and values into a new object","license":"MIT","repository":{"type":"git","url":"https://github.com/sindresorhus/map-obj"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=0.10.0"},"scripts":{"test":"node test.js"},"files":["index.js"],"keywords":["map","obj","object","key","keys","value","values","val","iterate","iterator"],"devDependencies":{"ava":"0.0.4"},"gitHead":"a4f2d49ae6b5f7c0e55130b49ab0412298b797bc","bugs":{"url":"https://github.com/sindresorhus/map-obj/issues"},"homepage":"https://github.com/sindresorhus/map-obj","_id":"map-obj@1.0.1","_shasum":"d933ceb9205d82bdcf4886f6742bdc2b4dea146d","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"shasum":"d933ceb9205d82bdcf4886f6742bdc2b4dea146d","tarball":"http://registry-npm.ywwl.com/map-obj/download/map-obj-1.0.1.tgz","integrity":"sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC20mvEe6hxPgZuJRJwFuzczzyZdsplruaQa36oxK6cLwIhAKHF0a/uO37dU+XkxC2Xpob+qGu8ry6SwGzerefvBT6d"}],"size":1549,"noattachment":false,"key":"/map-obj/-/map-obj-1.0.1.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"readme":"# map-obj\n\n> Map object keys and values into a new object\n\n## Install\n\n```sh\nnpm install map-obj\n```\n\n## Usage\n\n```js\nimport mapObject, {mapObjectSkip} from 'map-obj';\n\nconst newObject = mapObject({foo: 'bar'}, (key, value) => [value, key]);\n//=> {bar: 'foo'}\n\nconst newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value]);\n//=> {foo: true, bar: {bAz: true}}\n\nconst newObject = mapObject({FOO: true, bAr: {bAz: true}}, (key, value) => [key.toLowerCase(), value], {deep: true});\n//=> {foo: true, bar: {baz: true}}\n\nconst newObject = mapObject({one: 1, two: 2}, (key, value) => value === 1 ? [key, value] : mapObjectSkip);\n//=> {one: 1}\n```\n\n## API\n\n### mapObject(source, mapper, options?)\n\n#### source\n\nType: `object`\n\nThe source object to copy properties from.\n\n#### mapper\n\nType: `(sourceKey, sourceValue, source) => [targetKey, targetValue, mapperOptions?] | mapObjectSkip`\n\nA mapping function.\n\n##### mapperOptions\n\nType: `object`\n\n###### shouldRecurse\n\nType: `boolean`\\\nDefault: `true`\n\nWhether `targetValue` should be recursed.\n\nRequires `deep: true`.\n\n#### options\n\nType: `object`\n\n##### deep\n\nType: `boolean`\\\nDefault: `false`\n\nRecurse nested objects and objects in arrays.\n\n##### target\n\nType: `object`\\\nDefault: `{}`\n\nThe target object to map properties on to.\n\n### mapObjectSkip\n\nReturn this value from a `mapper` function to exclude the key from the new object.\n\n```js\nimport mapObject, {mapObjectSkip} from 'map-obj';\n\nconst object = {one: 1, two: 2}\nconst mapper = (key, value) => value === 1 ? [key, value] : mapObjectSkip\nconst result = mapObject(object, mapper);\n\nconsole.log(result);\n//=> {one: 1}\n```\n\n## Related\n\n- [filter-obj](https://github.com/sindresorhus/filter-obj) - Filter object keys and values into a new object\n\n---\n\n<div align=\"center\">\n\t<b>\n\t\t<a href=\"https://tidelift.com/subscription/pkg/npm-map-obj?utm_source=npm-map-obj&utm_medium=referral&utm_campaign=readme\">Get professional support for this package with a Tidelift subscription</a>\n\t</b>\n\t<br>\n\t<sub>\n\t\tTidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.\n\t</sub>\n</div>\n","publish_time":1430589766655,"_cnpm_publish_time":1430589766655,"dist-tags":{"latest":"7.0.0"}}