Nodejs Utililty Methods Array Where

List of utility methods to do Array Where

Description

The list of methods to do Array Where are organized into topic(s).

Method

where(inclusionTest)
Array.prototype.where = function (inclusionTest) {
    var results = [];
    for (var i = 0; i < this.length; i++) {
        if (inclusionTest(this[i]))
            results.push(this[i]);
    return results;
};
Array.prototype.select = function (projection) {
...
where(inclusionTest)
Array.prototype.where = function (inclusionTest) {
    var results = [];
    for (var i = 0; i < this.length; i++) {
        if (inclusionTest(this[i]))
            results.push(this[i]);
    return results;
};
where(predicate)
Array.prototype.where = function(predicate) {
    var derivedArray = [];
    for (i = 0; i < this.length; i += 1) {
        if (predicate(this[i])) {
            derivedArray.push(this[i]);
    return derivedArray;
where(predicate)
Array.prototype.where = function (predicate) {
    if (predicate == null || typeof (predicate) !== 'function') throw new Error('predicate should');
    var result = [];
    for (var i = 0; i < this.length; i++) {
        if (predicate(this[i], i)) result.push(this[i]);
    return result;
};
where(predicate)
Array.prototype.where = function (predicate) {
    var ret = [];
    for (var i = 0; i < this.length; ++i) {
        if (predicate(this[i], i))
            ret.push(this[i]);
    return ret;
};
where(predicate)
Array.prototype.where = function(predicate) {
    if (typeof(predicate) != "function") {
        throw new Error("The argument must be a function");
    var arr = [];
    var index = 0;
    var len = this.length;
    for (var i = 0; i < len; i++) {
        if (predicate(this[i])) {
...
where(predicate, context)
Array.prototype.where = Array.prototype.filter || function (predicate, context) {
  context = context || window;
  var arr = [];
  var l = this.length;
  for (var i = 0; i < l; i++)
    if (predicate.call(context, this[i], i, this) === true) arr.push(this[i]);
  return arr;
};
Where(func)
Array.prototype.Where = function (func) {
    var result = [];
    this.forEach(function (item) {
        if (func(item)) {
            result.push( item );
    });
    return result;
};
...
Where(lambda)
Array.prototype.Where = function (lambda) {
    if (typeof (lambda) !== "function")
        throw new Error("lambda must be a function");
    var results = [];
    for (var idx = 0; idx < this.length; idx++) {
        var obj = this[idx];
        if (lambda(obj))
            results.push(obj);
    return results;
WhereT(lambda, t)
Array.prototype.WhereT = function (lambda, t) {
    if (typeof (lambda) !== "function")
        throw new Error("lambda must be a function");
    var results = [];
    for (var idx = 0; idx < this.length; idx++) {
        var obj = this[idx];
        if (typeof (obj) !== t)
            throw new Error("array items must be " + t + " types but " + obj + " is a " + typeof (obj));
        if (lambda(obj))
...