Skip to content
Myr

Added Collection#grep()

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

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

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

2 files+24 added−0 removed

modified:lib/express/collection.js+14 added
203 unmodified lines
204 */205 206 any: function(fn) {207 return !! this.find(fn)208 },209 210 /**211 * Select values matching _pattern_212 *213 * @param {regexp} pattern214 * @return {Collection}215 * @api public216 */217 218 grep: function(pattern) {219 return this.select(function(val){220 return pattern.exec(val)221 })222 }223})224225/**
11 unmodified lines
modified:spec/spec.collection.js+10 added