Skip to content
Myr

Added Collection#select()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 3276ec8 · Browse files · 2 files+31 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+31 added−0 removed

  • tests:+14 added−0 removed
  • other:+17 added−0 removed

2 files+31 added−0 removed

modified:lib/express/collection.js+17 added
modified:spec/spec.collection.js+14 added
121 unmodified lines
122 $(['foo', 'bar']).any(function(val){ return val.charAt(0) == 'r' }).should.be_false123 end124 end125 126 describe '#select()'127 it 'should return values which evaluate to true'128 var result = $([1,2,3,4,5]).select(function(n){ return n % 2 })129 result.at(0).should.eql 0130 result.at(1).should.eql 2131 result.at(2).should.eql 4132 end133 134 it 'should return a Collection'135 var result = $([1,2,3,4,5]).select(function(n){ return n % 2 })136 result.should.be_an_instance_of Collection137 end138 end139 140 describe '#slice()'141 it 'should return a slice of values'142 var collection = $(['foo', 'bar', 'baz']).slice(1, 3)143 collection.at(0).should.eql 'bar'
12 unmodified lines