Skip to content
Myr

Added Collection#drop()

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

authored by visionmedia · committed by visionmedia · parent 3622914 · Browse files · 2 files+18 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+18 added−0 removed

  • tests:+6 added−0 removed
  • other:+12 added−0 removed

2 files+18 added−0 removed

modified:lib/express/collection.js+12 added
170 unmodified lines
171 return n ? this.slice(len-n, len) : this.at(--len)172 },173 174 /**175 * Drop the first _n_ values, returning the others.176 *177 * @param {int} n178 * @return {Collection}179 * @api public180 */181 182 drop: function(n) {183 return this.slice(n, this.length())184 },185 186 /**187 * Return a slice of values from _start_ to _end_.188 *189 * @param {int} start190 * @param {int} end
258 unmodified lines
modified:spec/spec.collection.js+6 added
109 unmodified lines
110 $({ a: 'foo', b: 'bar' }).last().should.eql 'bar'111 end 112 end113 114 describe '#drop()'115 it 'should drop the first n values'116 $(1..5).drop(2).arr.should.eql 3..5117 end118 end119 120 describe '#find()'121 it 'should return the value of the first match'122 var result = $(['foo', 'bar']).find(function(val){ return val.charAt(0) == 'b' })123 result.should.eql 'bar'
238 unmodified lines