{"name":"map-obj","version":"4.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":">=8"},"scripts":{"test":"xo && ava && tsd"},"keywords":["map","object","key","keys","value","values","iterate","iterator","rename","modify","deep","recurse","recursive"],"devDependencies":{"ava":"^2.0.0","tsd":"^0.7.3","xo":"^0.24.0"},"gitHead":"d35fa2d91642d269b7bfe2ebfe7c9915376fa92d","bugs":{"url":"https://github.com/sindresorhus/map-obj/issues"},"homepage":"https://github.com/sindresorhus/map-obj#readme","_id":"map-obj@4.0.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-Cqo6mRdpHmRD95I1vMjIKAv4KnH8Sn2me3Q1+BOFPboOzT7x7qr8lhtRmFwNG48RDiouOhiRL+L92kMpeBLhWw==","shasum":"20a2ac4341c42570a85de7a976ab6ba60e3c0870","tarball":"http://registry-npm.ywwl.com/map-obj/download/map-obj-4.0.0.tgz","fileCount":5,"unpackedSize":6797,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc+hfcCRA9TVsSAnZWagAANXcP/3eFElQyX49fScUzSwQb\nKGN4OmXP6u+fh0B6dkGTteaqaVYxahqoV++nyviBm5qhLoa+zVWUET5sOGBg\nM5jI3hJ6iT1vTkgj8l65dBITjs2Q99Wrw1JQlGzw1afZXmeDMQ+uz85n0llH\n7z0aIuoVqEAxaWXKv49Z6XdXUD5eyMxTBBTL7CnqKWj0suhFhcwhKls3FnfR\ndvowLNGcusX5yS5LRvSJxXEt9SB+Dc3rviIqoUtVBL4IQ4t5dD+FJQ0Wdj1c\nMb682FZ2KE0q/LYYxpjz18Wen39AK+FM2cRRqs183v4uqvSPpiJCMlI9cpHq\nfdQgZMcCbHBq/JMW2OjuumDGmoCjmmkpFuIVkaZ4FcXk8Dzh1npAnOofsiPL\nD/oRKLU4GR5MmuGzFQpDPAg1FLawC+HtRMQWK7FzUYjjMk3zwln4deXdP/vR\nLI8Gyo8TLg7gAq2iYh2iFVwfWDvawCQ8ill6a1j2BwPQwnkC2be3qUudGyLL\ncSDF4xTXnfaJwb+eqO9uIMUbtwIPOVvSeDJMGtrgXIui+tpOH5a9BQAScOoN\nfLlkAS13VaD/iTpMLgMYhJib3+0qarkEeIiL+YcGSdus/OJ0J6C21bNmc8kd\nAdBB8DRG/Xr1eJUa74A7ZuEwKsBKaVepCt1DytyKXvLrw1AWAEOmtbVtr0eG\nmKOz\r\n=bVih\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF8Ro8HxJfVraymO02tOYvz0lyfnHWfsbdcX5E6Y8FSFAiEA5/iMIW1K27IN79+TrJ+VuX0nAZR2iSQxLyt3MNbWEIs="}],"size":2643,"noattachment":false,"key":"/map-obj/-/map-obj-4.0.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/map-obj_4.0.0_1559893979425_0.9001481014415618"},"_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":1559893979540,"_cnpm_publish_time":1559893979540,"dist-tags":{"latest":"7.0.0"}}