Skip to content

Commit

Permalink
add .findLast(fn)
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Nov 21, 2012
1 parent b125421 commit feb88ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Expand Up @@ -286,6 +286,7 @@ proto.find = function(fn){
*/

proto.findLast = function(fn){
fn = toFunction(fn);
var ret;
var val;
var vals = this.__iterate__();
Expand Down
6 changes: 6 additions & 0 deletions test/index.js
Expand Up @@ -43,6 +43,12 @@ describe('.findLast(fn)', function(){
})
})

describe('.findLast(string)', function(){
it('should assert woth expression strings', function(){
_(['foo', 'bar', 'baz']).findLast('!= "foo"').should.equal('baz');
})
})

describe('.every(fn)', function(){
it('should alias .all()', function(){
var arr = _([1,2,3,4,5]);
Expand Down

0 comments on commit feb88ea

Please sign in to comment.