[Solved] Underscore filter array of object using like query


Try this

function getResult(keyToFilter, valueStartsWith){
    return _.filter(results, function(d){ return d[keyToFilter].startsWith(valueStartsWith); })
}

getResult("name", "asdfui");

[{
  "id": "203",
  "name": "asdfui uiuu"
},
{
  "id": "205",
  "name": "asdfui uyu"
}]

0

solved Underscore filter array of object using like query