{"_id":"first-match","_rev":"95109","name":"first-match","description":"Find the first element in an array that passes a callback test. Equivalent to underscore.find()","dist-tags":{"latest":"0.0.1"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"time":{"modified":"2021-06-03T10:31:42.000Z","created":"2013-01-05T14:24:15.381Z","0.0.1":"2013-01-05T14:24:15.381Z"},"users":{},"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"htttp://hughskennedy.com/"},"repository":{"type":"git","url":"git://github.com/hughsk/first-match.git"},"versions":{"0.0.1":{"name":"first-match","version":"0.0.1","description":"Find the first element in an array that passes a callback test. Equivalent to underscore.find()","main":"index.js","scripts":{"test":"node node_modules/.bin/mocha -u tdd --reporter spec"},"keywords":["element","array","first","truth","test","find"],"author":{"name":"Hugh Kennedy","email":"hughskennedy@gmail.com","url":"htttp://hughskennedy.com/"},"license":"MIT","repository":{"type":"git","url":"git://github.com/hughsk/first-match.git"},"devDependencies":{"mocha":"~1.7.4"},"_id":"first-match@0.0.1","dist":{"shasum":"a60ec642700f0f437234ebb7ec3f382476e542fd","size":2135,"noattachment":false,"key":"/first-match/-/first-match-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/first-match/download/first-match-0.0.1.tgz"},"maintainers":[{"name":"hughsk","email":"hughskennedy@gmail.com"}],"directories":{},"publish_time":1357395855381,"_cnpm_publish_time":1357395855381,"_hasShrinkwrap":false}},"readme":"# first-match [![Build Status](https://travis-ci.org/hughsk/first-match.png?branch=master)](https://travis-ci.org/hughsk/first-match?branch=master) #\n\nFinds the first element in an array that passes a callback test.\nEquivalent to [_.find()](http://underscorejs.org#find).\n\n## Installation ##\n\n``` bash\nnpm install first-match\n```\n\n## Usage ##\n\n`first(array, [iterator], [context])`. If an iterator is not passed, the method\nwill just return the first truthy value in the array. The context defaults to\nthe array being evaluated.\n\n``` javascript\nvar first = require('first-match')\n  , array = [0, 1, 2, 3, 4, 5]\n\nfirst(array)                               // 1\nfirst(array, function(n) { return n > 3 }) // 4\nfirst(array, function(n) { return n % 2 }) // 1\nfirst(array, function(n) { return n + 2 > this.length }) // 5\n```","_attachments":{},"license":"MIT"}