{"_id":"mapsome","_rev":"4177234","name":"mapsome","description":"find maped element of an array that will satisfy condition of some","dist-tags":{"latest":"1.0.0"},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"time":{"modified":"2026-03-01T21:37:40.000Z","created":"2016-07-04T16:57:04.679Z","1.0.0":"2016-07-04T16:57:04.679Z"},"users":{},"author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"http://coderaiser.github.io/"},"repository":{"type":"git","url":"git://github.com/coderaiser/mapsome.git"},"versions":{"1.0.0":{"name":"mapsome","version":"1.0.0","description":"find maped element of an array that will satisfy condition of some","main":"lib/mapsome.js","babel":{"presets":["es2015"]},"scripts":{"test":"tape 'test/**/*.js'","eslint":"eslint lib test","lint":"redrun eslint","coverage":"nyc npm test","report":"nyc report --reporter=text-lcov | coveralls","6to5":"babel lib -d legacy","wisdom":"npm run build","mkdir":"mkdirp dist legacy","minify":"minify dist/mapsome.js > dist/mapsome.min.js","build":"redrun mkdir 6to5 legacy:index bundle:legacy minify","bundle:base":"browserify -s mapsome --ng false","legacy:index":"echo \"module.exports = require('./mapsome');\" > legacy/index.js","bundle:legacy:base":"npm run bundle:base -- -r ./legacy/mapsome.js:mapsome ./legacy/mapsome.js","bundle:legacy":"npm run bundle:legacy:base -- -o dist/mapsome.js"},"repository":{"type":"git","url":"git://github.com/coderaiser/mapsome.git"},"keywords":["map","some","array","functional","list"],"author":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com","url":"http://coderaiser.github.io/"},"license":"MIT","bugs":{"url":"https://github.com/coderaiser/mapsome/issues"},"homepage":"https://github.com/coderaiser/mapsome","devDependencies":{"babel-cli":"^6.10.1","babel-preset-es2015":"^6.9.0","browserify":"^13.0.1","eslint":"^3.0.0","minify":"^2.0.9","mkdirp":"^0.5.1","nyc":"^6.6.1","redrun":"^4.0.0","tape":"^4.6.0"},"gitHead":"c4ead91f5241583afea743503ad60595be72a1c8","_id":"mapsome@1.0.0","_shasum":"70bf732b3eeab66aee7042158202885a17625c41","_from":".","_npmVersion":"3.9.5","_nodeVersion":"6.2.2","_npmUser":{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"},"maintainers":[{"name":"coderaiser","email":"mnemonic.enemy@gmail.com"}],"dist":{"shasum":"70bf732b3eeab66aee7042158202885a17625c41","size":3128,"noattachment":false,"key":"/mapsome/-/mapsome-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/mapsome/download/mapsome-1.0.0.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/mapsome-1.0.0.tgz_1467651422361_0.704479101113975"},"directories":{},"_cnpmcore_publish_time":"2021-12-19T11:53:19.355Z","publish_time":1467651424679,"_cnpm_publish_time":1467651424679}},"readme":"# Mapsome [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]\n\nFind maped element of an array that will satisfy condition of some.\n\n[Map][mapURL] + [Some][someURL] + `early return of an element`;\n\n## Install\n\n```\nnpm i mapsome --save\n```\n\n## How come?\n\nLets look at regular `map-filter` example:\n\n```js\nconst map = (a) => ++a;\nconst condition = (a) => a > 2;\n\n[1, 2, 3, 4]\n    .map(map)           /* loop full array */\n    .filter(condition)  /* loop full array again */\n    .pop();             /* get value */\n// returns\n3\n```\n\nWith `mapsome` this would look this way:\n\n```js\nconst map = (a) => ++a;\nconst condition = (a) => a > 2;\n\nmapsome(map, condition, [1, 2, 3, 4]);\n// returns\n3\n```\n\n`mapsome` works much faster because no need map full array, first satisfied condition will break the loop.\n\n## API\n### mapsome(map [, condition ], array)\n- mapping function\n- condition of stopping the loop\n- array\n\n`mapsome` could be used with `map` function only:\n\n```js\nconst map = (a) => ++a;\nmapsome(map, [0, 0, 3, 0]);\n// returns\n3\n\n// same as\nmapsome(map, a => a, [0, 0, 3, 0]);\n// returns\n3\n```\n## Environments\n\n### Node.js\n\nIn old `node.js` environments that supports `es5` only, `mapsome` could be used with:\n\n```js\nvar mapsome = require('mapsome/legacy');\n```\n\n### Web Browser\n\n`mapsome` could be installed via `bower` with:\n\n```sh\nbower install mapsome --save\n```\n\nWhen loaded in browser `mapsome` uses global variable with same name (when `browserify` or `webpack` did not used).\n\n## License\n\nMIT\n\n[NPMIMGURL]:                https://img.shields.io/npm/v/mapsome.svg?style=flat\n[BuildStatusIMGURL]:        https://img.shields.io/travis/coderaiser/mapsome/master.svg?style=flat\n[DependencyStatusIMGURL]:   https://img.shields.io/gemnasium/coderaiser/mapsome.svg?style=flat\n[LicenseIMGURL]:            https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat\n[NPMURL]:                   https://npmjs.org/package/mapsome \"npm\"\n[BuildStatusURL]:           https://travis-ci.org/coderaiser/mapsome  \"Build Status\"\n[DependencyStatusURL]:      https://gemnasium.com/coderaiser/mapsome \"Dependency Status\"\n[LicenseURL]:               https://tldrlegal.com/license/mit-license \"MIT License\"\n\n[someURL]:                  https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some\n[mapURL]:                   https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map\n\n","_attachments":{},"homepage":"https://github.com/coderaiser/mapsome","bugs":{"url":"https://github.com/coderaiser/mapsome/issues"},"license":"MIT"}