{"name":"map-obj","version":"3.1.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 && tsd"},"keywords":["map","object","key","keys","value","values","iterate","iterator","rename","modify","deep","recurse","recursive"],"devDependencies":{"ava":"^1.4.1","tsd":"^0.7.2","xo":"^0.24.0"},"gitHead":"5556028fd392f4fbdf18c1c604b0b0c883dd99f7","bugs":{"url":"https://github.com/sindresorhus/map-obj/issues"},"homepage":"https://github.com/sindresorhus/map-obj#readme","_id":"map-obj@3.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.15.3","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-Xg1iyYz/+iIW6YoMldux47H/e5QZyDSB41Kb0ev+YYHh3FJnyyzY0vTk/WbVeWcCvdXd70cOriUBmhP8alUFBA==","shasum":"3be9810d926db2f8612c728a2e95e03b7f109241","tarball":"http://registry-npm.ywwl.com/map-obj/download/map-obj-3.1.0.tgz","fileCount":5,"unpackedSize":6628,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcvWK1CRA9TVsSAnZWagAAk9cQAJLcJ5tv/izqk/dwpiN0\nAlBuYm9ELBeePfQ8KaEfHkLcvdp7uYks9kgPRlnR3tHghtQigd/XFSCTQDvN\nBvdU9aAnNKqPaejduocdW0CTBMYLerYqMkcaoS7O8rn33nQ3DenMkCiC3fbp\nCjLr80OheQz5ZIm6Plqe6nWFHBGm5i0LidGMYVBSqPh38cvBdJn2gnbbLKiT\nOSIyWHY8WE5n+c527+hjWsPU7OA2RMAac9n5OQSXWGEGaUJiU4SKc/dtkOPi\n4EDxUNcoEu+B9ec16dpycpN1Pgd28XUJf922NLJX48VTdZAiJ1MjrjNfsMs5\nL9IQdHNYZ5adFnpviGAjwfmUla4AVcghqEJpXt2SpjXjsH40z5t+8D5de4OT\nt3K9wMA+MPVczg9jqFJn8WusQaL9OYkX/9EEMYqdSjtTx5Xl+Idj+xPk5XcP\napBgejCCVUWvc6a9gMVCVfb79K5MG8RbVSYVmQj9bWBkScwPnvQanu8qTjJJ\nURMuexh193cy96XDxVJmGBHcK0Y9E8jk3rxUR2n9reJs1G1Ndz85ZkngMxVM\nap/76i7CWLsDfgSv3XQmVOJaQnc//aELcUCwXw1unuHUL9hiSyZIVd1jpD8E\nsDtJ+0z/SmWt5um+3RjCt2sVdi2KBsPujdzkVXVzBcJZsjL3pADScIwPALOS\nbjkm\r\n=Cc3B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDSYp4Vwx19fGookbm46d/sqzJnGC1zCZOm1ncIW9vNIQIhAN2rmXD03/ESogrcBz8/tvlcDSUBFtyXTJJSOzQbv9+m"}],"size":2500,"noattachment":false,"key":"/map-obj/-/map-obj-3.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/map-obj_3.1.0_1555915444512_0.3163818961387286"},"_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":1555915444714,"_cnpm_publish_time":1555915444714,"dist-tags":{"latest":"7.0.0"}}