Skip to content
Myr

Added Collection#reject()

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

authored by visionmedia · committed by visionmedia · parent ca229ba · Browse files · 2 files+36 added−5 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+36 added−5 removed

  • tests:+17 added−3 removed
  • other:+19 added−2 removed

2 files+36 added−5 removed

modified:lib/express/collection.js+19 added-2 removed
113 unmodified lines
114 * @api public115 */116 117 select: function(fn) {118 return $(this.reduce([], function(array, key, val){119 if (fn(key, val))118 return $(this.reduce([], function(array, val, key){119 if (fn(val, key))120 array.push(val)121 return array122 }))123 },124 125 /**126 * Return collection of values when _fn_ evaluates127 * to false.128 *129 * @param {function} fn130 * @return {Collection}131 * @api public132 */133 134 reject: function(fn) {135 return $(this.reduce([], function(array, val, key){136 if (!fn(val, key))137 array.push(val)138 return array139 }))140 },141 142 /**143 * Return the first _n_ value(s), defaults to 1.144 *145 * @param {int} n146 * @return {mixed}
76 unmodified lines
modified:spec/spec.collection.js+17 added-3 removed