Node.js examples for Array:Search
Get first value by predicate
Array.prototype.first = function (predicate) { for (var i = 0; i < this.length; ++i) { if (predicate(this[i])) return this[i]; }// www . j a va 2 s.co m };