{"name":"map-obj","version":"3.0.0","description":"Map object keys and values into a new object","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/map-obj.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"sindresorhus.com"},"engines":{"node":">=6"},"scripts":{"test":"xo && ava"},"files":["index.js"],"keywords":["map","obj","object","key","keys","value","values","val","iterate","iterator","rename","modify","deep","recurse","recursive"],"devDependencies":{"ava":"*","xo":"*"},"gitHead":"4db51b6f5f6d2b617bc80bb66dd6a6e528dc4cb7","bugs":{"url":"https://github.com/sindresorhus/map-obj/issues"},"homepage":"https://github.com/sindresorhus/map-obj#readme","_id":"map-obj@3.0.0","_npmVersion":"6.3.0","_nodeVersion":"8.11.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-Ot+2wruG8WqTbJngDxz0Ifm03y2pO4iL+brq/l+yEkGjUza03BnMQqX2XT//Jls8MOOl2VTHviAoLX+/nq/HXw==","shasum":"4221cc62360f88c0735f9e7c0813bd889657f490","tarball":"http://registry-npm.ywwl.com/map-obj/download/map-obj-3.0.0.tgz","fileCount":4,"unpackedSize":3828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbapFHCRA9TVsSAnZWagAASvIP/0rnvWwHNZAH8bWVBSC8\nAqJmb5GURwi3HxLfLzMdLWIErLn/oGhz2aALSZbEoiiDEP7fVJTWxtY5ihiv\nWd/fgi/iU4HFsuCyIl02nF0UiMDzFiU+09UhDfTQUZdKgYrH/UZ1K9NUxbzF\nn39PWz4FKqChUIX6yIzOyHrMTueQiuL0+AMDhId8naFiWV5jMwe5x6xuOOr1\nHeStv/Sug+LGgf+481CKidw2ZpaORq0GxcnOERSjR45aaWC36SbUjQiv7eFl\nIEvdZ9DMa7IOI2HewgGpp5clt/x9sv/uco69jAjunJbz/z+D6u17X2+Tiyce\ntVSgDTS1ipVv5kp8PHUwOIbaJytw+RVj8XXmVilMhoZdLBkWm3ENuWUxobFC\ntRxMeolAWg2wZ5Kurzyf9utCV4URdR1BC/+Wy+uE6kEsIwcb3fxTwOsQxCSF\nPu5nCscYsz4Sy8MBOZ+QaBFUjqZzf1gPXJll+eMHmGxhHNFl5QTJVMm6fCDo\ni3JW1BJVbzLap2Rs9Fzj9qyEOpi83bnt+w8KdoT5wE2OqeIMbKFMoRjBxYHn\nbt1PP5XeyOwZYZ6xh+7uQyIY2kVBb+mhKNbZRRVUtVgwYLaI3j1PH04q9csX\nvQ1Hn5CbS/KvWWXsR7C26s4rng902wYxNANUKI5wJwdjUXTapq0c26sEQvtb\nh9K/\r\n=gFyF\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFOj0HgMZbj4kcSFQdqbSqCWFgiChQRqYn1hO3fLpbgdAiBcYJM1ZOEzMX6aGzaQH2CgnKDFHYCwPsufaaztLpso/Q=="}],"size":2032,"noattachment":false,"key":"/map-obj/-/map-obj-3.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/map-obj_3.0.0_1533710662889_0.49796460121473984"},"_hasShrinkwrap":false,"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":1533710663091,"_cnpm_publish_time":1533710663091,"dist-tags":{"latest":"7.0.0"}}