These are chat archives for Tzahile/Hello

8th
Dec 2015
Tzahi
@Tzahile
Dec 08 2015 11:48
This message was deleted
function where(collection, source) {
  var arr = [];
  var key;
  // What's in a name?
  for(i=0; i<Object.keys(source).length; i++){
    key = Object.keys(source)[i];
    for(j=0; j<collection.length; j++){
      if(collection[j][key]!==undefined){
        if (collection[j][key]===source[key])
          arr.push(collection[j]);
      }
    }
  }
  return arr;
}

where([{ first: "Romeo", last: "Montague" }, { first: "Mercutio", last: null }, { first: "Tybalt", last: "Capulet" }], { last: "Capulet" });
partly answer to bf: "Where Art Thou"