{"_id":"mapz","_rev":"398734","name":"mapz","description":"Functional map with sugar","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"time":{"modified":"2021-08-04T04:23:18.000Z","created":"2016-07-16T13:56:10.925Z","2.0.0":"2021-03-12T11:21:58.817Z","1.0.4":"2020-01-25T11:21:55.068Z","1.0.3":"2019-05-09T08:46:38.985Z","1.0.2":"2018-04-21T09:11:46.011Z","1.0.1":"2017-07-18T15:02:39.603Z","1.0.0":"2016-07-16T13:56:10.925Z"},"users":{},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"repository":{"type":"git","url":"git+https://github.com/wooorm/mapz.git"},"versions":{"2.0.0":{"name":"mapz","version":"2.0.0","description":"Functional map with sugar","license":"MIT","keywords":["map","function","sugar"],"repository":{"type":"git","url":"git+https://github.com/wooorm/mapz.git"},"bugs":{"url":"https://github.com/wooorm/mapz/issues"},"funding":{"type":"github","url":"https://github.com/sponsors/wooorm"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.38.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"eqeqeq":["error","always",{"null":"ignore"}],"no-eq-null":"off","no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"0581a9098f14bf4f5ce4cc3d15e82bd582b0c1fd","homepage":"https://github.com/wooorm/mapz#readme","_id":"mapz@2.0.0","_nodeVersion":"15.11.0","_npmVersion":"7.6.2","dist":{"shasum":"4b701bc34d28e2c038697683e37448626c93c0f3","size":3466,"noattachment":false,"key":"/mapz/-/mapz-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mapz/download/mapz-2.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapz_2.0.0_1615548118656_0.7744895860863725"},"_hasShrinkwrap":false,"publish_time":1615548118817,"_cnpm_publish_time":1615548118817},"1.0.4":{"name":"mapz","version":"1.0.4","description":"Functional map with sugar","license":"MIT","keywords":["map","function","sugar"],"repository":{"type":"git","url":"git+https://github.com/wooorm/mapz.git"},"bugs":{"url":"https://github.com/wooorm/mapz/issues"},"funding":{"type":"github","url":"https://github.com/sponsors/wooorm"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{"x-is-array":"^0.1.0"},"devDependencies":{"browserify":"^16.0.0","nyc":"^15.0.0","prettier":"^1.0.0","remark-cli":"^7.0.0","remark-preset-wooorm":"^6.0.0","tape":"^4.0.0","tinyify":"^2.0.0","xo":"^0.25.0"},"scripts":{"format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","build-bundle":"browserify . -s mapz -o mapz.js","build-mangle":"browserify . -s mapz -p tinyify -o mapz.min.js","build":"npm run build-bundle && npm run build-mangle","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run format && npm run build && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false,"ignores":["mapz.js"]},"remarkConfig":{"plugins":["preset-wooorm"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"gitHead":"2bb35289152007db3f462e895cf9f16bad7988f5","homepage":"https://github.com/wooorm/mapz#readme","_id":"mapz@1.0.4","_nodeVersion":"13.0.1","_npmVersion":"6.13.6","dist":{"shasum":"1d29d162e41c22124490a20aba3da24540bf19fb","size":2998,"noattachment":false,"key":"/mapz/-/mapz-1.0.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/mapz/download/mapz-1.0.4.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapz_1.0.4_1579951314835_0.15648241504494687"},"_hasShrinkwrap":false,"publish_time":1579951315068,"_cnpm_publish_time":1579951315068},"1.0.3":{"name":"mapz","version":"1.0.3","description":"Functional map with sugar","license":"MIT","keywords":["map","function","sugar"],"repository":{"type":"git","url":"git+https://github.com/wooorm/mapz.git"},"bugs":{"url":"https://github.com/wooorm/mapz/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{"x-is-array":"^0.1.0"},"devDependencies":{"browserify":"^16.0.0","nyc":"^14.0.0","prettier":"^1.12.1","remark-cli":"^6.0.0","remark-preset-wooorm":"^4.0.0","tape":"^4.0.0","tinyify":"^2.5.0","xo":"^0.24.0"},"scripts":{"format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","build-bundle":"browserify . -s mapz -o mapz.js","build-mangle":"browserify . -s mapz -p tinyify -o mapz.min.js","build":"npm run build-bundle && npm run build-mangle","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run format && npm run build && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false,"ignores":["mapz.js"]},"remarkConfig":{"plugins":["preset-wooorm"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"gitHead":"a0fe0e20f0907c5f72e904bf0be80ef75bcc2844","homepage":"https://github.com/wooorm/mapz#readme","_id":"mapz@1.0.3","_nodeVersion":"11.9.0","_npmVersion":"6.9.0","dist":{"shasum":"cf878fe016894d08b5ed3120a12c4d8849edbe9c","size":2978,"noattachment":false,"key":"/mapz/-/mapz-1.0.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/mapz/download/mapz-1.0.3.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapz_1.0.3_1557391598833_0.2362937665925504"},"_hasShrinkwrap":false,"publish_time":1557391598985,"_cnpm_publish_time":1557391598985},"1.0.2":{"name":"mapz","version":"1.0.2","description":"Functional map with sugar","license":"MIT","keywords":["map","function","sugar"],"files":["index.js"],"repository":{"type":"git","url":"git+https://github.com/wooorm/mapz.git"},"bugs":{"url":"https://github.com/wooorm/mapz/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"dependencies":{"x-is-array":"^0.1.0"},"devDependencies":{"browserify":"^16.0.0","esmangle":"^1.0.1","nyc":"^11.0.0","prettier":"^1.12.1","remark-cli":"^5.0.0","remark-preset-wooorm":"^4.0.0","tape":"^4.0.0","xo":"^0.20.0"},"scripts":{"format":"remark . -qfo && prettier --write '**/*.js' && xo --fix","build-bundle":"browserify index.js --bare -s mapz > mapz.js","build-mangle":"esmangle < mapz.js > mapz.min.js","build":"npm run build-bundle && npm run build-mangle","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run format && npm run build && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false,"rules":{"eqeqeq":"off","no-eq-null":"off","no-var":"off","prefer-arrow-callback":"off"},"ignores":["mapz.js"]},"remarkConfig":{"plugins":["preset-wooorm"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"gitHead":"343ac5b799df633f4b91a9af081f0635e7eb86c6","homepage":"https://github.com/wooorm/mapz#readme","_id":"mapz@1.0.2","_npmVersion":"5.6.0","_nodeVersion":"9.5.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"shasum":"f6af94c425db0874ac2c4e67a76f5df1724b1322","size":2962,"noattachment":false,"key":"/mapz/-/mapz-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/mapz/download/mapz-1.0.2.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapz_1.0.2_1524301905757_0.8418424016231996"},"_hasShrinkwrap":false,"publish_time":1524301906011,"_cnpm_publish_time":1524301906011},"1.0.1":{"name":"mapz","version":"1.0.1","description":"Functional map with sugar","license":"MIT","keywords":["map","function","sugar"],"files":["index.js"],"repository":{"type":"git","url":"git+https://github.com/wooorm/mapz.git"},"bugs":{"url":"https://github.com/wooorm/mapz/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"dependencies":{"x-is-array":"^0.1.0"},"devDependencies":{"browserify":"^14.1.0","esmangle":"^1.0.1","nyc":"^11.0.0","remark-cli":"^3.0.0","remark-preset-wooorm":"^3.0.0","tape":"^4.0.0","xo":"^0.18.0"},"scripts":{"build-md":"remark . -qfo","build-bundle":"browserify index.js --bare -s mapz > mapz.js","build-mangle":"esmangle < mapz.js > mapz.min.js","build":"npm run build-md && npm run build-bundle && npm run build-mangle","lint":"xo","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run build && npm run lint && npm run test-coverage"},"xo":{"space":true,"esnext":false,"rules":{"eqeqeq":"off","no-eq-null":"off"},"ignores":["mapz.js"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"001d71bccf41e20bc743faeb4a4ad9e1c05ff78d","homepage":"https://github.com/wooorm/mapz#readme","_id":"mapz@1.0.1","_shasum":"9ecec757d3c3fe0a8a6f363e328eaee69a428441","_from":".","_npmVersion":"2.14.2","_nodeVersion":"4.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"shasum":"9ecec757d3c3fe0a8a6f363e328eaee69a428441","size":2854,"noattachment":false,"key":"/mapz/-/mapz-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/mapz/download/mapz-1.0.1.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/mapz-1.0.1.tgz_1500390158615_0.9842000128701329"},"directories":{},"publish_time":1500390159603,"_cnpm_publish_time":1500390159603,"_hasShrinkwrap":false},"1.0.0":{"name":"mapz","version":"1.0.0","description":"Functional map with sugar","license":"MIT","keywords":["map","function","sugar"],"files":["index.js"],"repository":{"type":"git","url":"git+https://github.com/wooorm/mapz.git"},"bugs":{"url":"https://github.com/wooorm/mapz/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"dependencies":{"x-is-array":"^0.1.0","x-is-string":"^0.1.0"},"devDependencies":{"browserify":"^13.0.1","esmangle":"^1.0.1","nyc":"^7.0.0","remark-cli":"^1.0.0","remark-comment-config":"^4.0.0","remark-github":"^5.0.0","remark-lint":"^4.0.0","remark-validate-links":"^4.0.0","tape":"^4.0.0","xo":"^0.16.0"},"scripts":{"build-md":"remark . --quiet --frail","build-bundle":"browserify index.js --bare -s mapz > mapz.js","build-mangle":"esmangle < mapz.js > mapz.min.js","build":"npm run build-md && npm run build-bundle && npm run build-mangle","lint":"xo","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run build && npm run lint && npm run test-coverage"},"xo":{"space":true,"rules":{"eqeqeq":"off","no-eq-null":"off"},"ignores":["mapz.js","mapz.min.js"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"remarkConfig":{"output":true,"plugins":["comment-config","github","lint","validate-links"],"settings":{"bullet":"*"}},"gitHead":"48d26834ba46d8e3f7e81dd676f5065b360d977b","homepage":"https://github.com/wooorm/mapz#readme","_id":"mapz@1.0.0","_shasum":"d62f6535b602dc13182a54b50125f3c61d5f6307","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"shasum":"d62f6535b602dc13182a54b50125f3c61d5f6307","size":3155,"noattachment":false,"key":"/mapz/-/mapz-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mapz/download/mapz-1.0.0.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/mapz-1.0.0.tgz_1468677369800_0.18264984665438533"},"directories":{},"publish_time":1468677370925,"_cnpm_publish_time":1468677370925,"_hasShrinkwrap":false}},"readme":"# mapz\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n\nFunctional map with sugar.\n\n## Install\n\nThis package is ESM only: Node 12+ is needed to use it and it must be `import`ed\ninstead of `require`d.\n\n[npm][]:\n\n```sh\nnpm install mapz\n```\n\n## Use\n\n```js\nimport {mapz} from 'mapz'\n\nvar map = mapz(fn, {key: 'children', gapless: true})\n\nmap({children: [1, 2, 3]}) // => ['Hi, 2', 'Hi, 3']\n\nfunction fn(value) {\n  return value > 1 ? 'Hi, ' + value + '.' : null\n}\n```\n\n## API\n\nThis package exports the following identifiers: `mapz`.\nThere is no default export.\n\n### `mapz(fn[, options])`\n\nFunctional map with sugar (functional, as values are provided as a parameter,\ninstead of context object).\n\nWraps the supplied [`fn`][fn], which handles one value, so that it accepts\nmultiple values, calling `fn` for each and returning all results.\n\nIf `options` is a string, it’s treated as `{key: options}`.\n\n###### `options.gapless`\n\nWhether to filter out `null` and `undefined` results (`boolean`, default:\n`false`).\n\n###### `options.key`\n\nIf a key (`string`, optional) is given, and an object supplied to the wrapped\n`fn`, values at that object’s `key` field are mapped and the object, instead\nof the values, is given to `fn` as a last parameter.\nIf a key is given and an array is passed to the wrapped `fn`, no value is given\nto `fn` as a last parameter.\n\n###### Returns\n\n`Function` — See [`map(values)`][map]\n\n#### `map(values)`\n\nCall the bound [`fn`][fn] for all values.  If a `key` is bound, `values` can\nbe an object.\nSee [`options.key`][key] for more info.\n\n###### Returns\n\n`Array.<*>` — Values returned by `fn`.  If `gapless` is `true`, `null` or\n`undefined` results are not returned by `map`.\n\n#### `fn(value, parent?)`\n\nHandle one value.\nIf `key` is set and an array is given, no `parent` is passed.\n\n###### Returns\n\n`*` — Any value.\n\n## Related\n\n*   [`zwitch`](https://github.com/wooorm/zwitch)\n    — Handle values based on a property\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/wooorm/mapz/workflows/main/badge.svg\n\n[build]: https://github.com/wooorm/mapz/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/wooorm/mapz.svg\n\n[coverage]: https://codecov.io/github/wooorm/mapz\n\n[downloads-badge]: https://img.shields.io/npm/dm/mapz.svg\n\n[downloads]: https://www.npmjs.com/package/mapz\n\n[size-badge]: https://img.shields.io/bundlephobia/minzip/mapz.svg\n\n[size]: https://bundlephobia.com/result?p=mapz\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[map]: #mapvalues\n\n[key]: #optionskey\n\n[fn]: #fnvalue-parent\n","_attachments":{},"homepage":"https://github.com/wooorm/mapz#readme","bugs":{"url":"https://github.com/wooorm/mapz/issues"},"license":"MIT"}