Skip to content
Myr

Added Collection#reverse()

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

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

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

2 files+19 added−0 removed

modified:lib/express/collection.js+13 added
86 unmodified lines
87 return this88 },89 90 /**91 * Reverse a collection.92 *93 * @return {Collection}94 * @api public95 */96 97 reverse: function() {98 if (this.arr.reverse)99 return $(this.arr.reverse())100 return this101 },102 103 /**104 * Iterate with _memo_ using callback _fn_.105 * The _memo_ object is passed as the first 106 * argument, and the return value of _fn_ becomes107 * the value of _memo_ providing a functional
389 unmodified lines
modified:spec/spec.collection.js+6 added
375 unmodified lines
376 $([1,2,3,4]).sample().should.eql 1377 end378 end379 380 describe '#reverse()'381 it 'should reverse a collection'382 $([1,2,3]).reverse().toArray().should.eql [3,2,1]383 end384 end385 386 describe '#toString()'387 it 'should output [Collection ...] for array'388 $([1,2,3]).toString().should.eql '[Collection 1,2,3]'389 end
12 unmodified lines