{"name":"map-obj","version":"4.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":">=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":"ab153427cc788e28448f2e1800eaec1c43610d38","bugs":{"url":"https://github.com/sindresorhus/map-obj/issues"},"homepage":"https://github.com/sindresorhus/map-obj#readme","_id":"map-obj@4.1.0","_nodeVersion":"8.16.0","_npmVersion":"6.9.0","_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"dist":{"integrity":"sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g==","shasum":"b91221b542734b9f14256c0132c897c5d7256fd5","tarball":"http://registry-npm.ywwl.com/map-obj/download/map-obj-4.1.0.tgz","fileCount":5,"unpackedSize":7054,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdBIskCRA9TVsSAnZWagAAY9AP/1k8+pmTqJ90rEGXi6vZ\nEByP6XwafRMz5yae+2GFxy0MTkvR38Me8vz5tN134XdBpJ6JMbTXSXWpX/yU\nvggfsIds1jA5jP/ivfcOJwlshutX9xmnmLAsj6idQ1We/0syS58xCtKLmOYs\nXNyzserR6QX0/SVOwTkpP/ayKktCArCVfQ34kaLraEb9UDn79NDN5by90a9R\n3d+SonjPYMC3RKPmOWbWHsJ3tkWR6/CPsgplKSrshZDwWHdgeP6L2vH4Ion2\narxIXMQfBtuk5ndb8IeWcY5HnKi2MH+L2DkvH9zDDpi94BRQmyWi1kYAJmBo\nlINFKbE7HmAjvCYbvl1hmHYAGR+jm/UyHleKOjt9kuDQHXFoATZMKGeDHuFn\n3qL88+p1or3x80yhNGtrS0JgAbltaoY2amhktocGE/cs9hEhVeSWfH3GK8PT\nYDLwZ2GS/RRsCNR5D20iRn+0Yum9+t6DxqrXVcQKN549N+QzaJ1t0EkwvaSw\nLpppEedOPS/kZe2MnlrL5yCn82mlMhqvWkNwNtrXUHZ3MHWL+YNKN0eTK6rP\n4gt1XuFCZ/KfsgTGFTvL6T8HPSwWFchn/5QK4hzi+JoNTFMGfqUL+5G2kHus\nml6YJv8QPTKe4ElJZv8yoSZvKXQwLtuGuz8KukY9cqvmcDRr0uvCFls6+cw7\nCQ22\r\n=I4Q7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAuaaEHRUM6z4H/UJsPcrhkP6lfh5YzuHzynVK+jesfgAiEAuW0tnYtPSXSR4ucDwCS+OnmxdC82OzJ725xHRrgnkMs="}],"size":2730,"noattachment":false,"key":"/map-obj/-/map-obj-4.1.0.tgz"},"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/map-obj_4.1.0_1560578851920_0.028448962438873515"},"_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":1560578852018,"_cnpm_publish_time":1560578852018,"dist-tags":{"latest":"7.0.0"}}