AngularJS

Angular Snippet: matchCaseFilter

<div ng-repeat="item in arr | objFilter:'name':keyword:matchCase"></div>

arr = [
  {name: 'A'}
  {name: 'B'}
]

app.filter 'objFilter', ->
  return (input, prop, value, matchCase) ->
    arr = []
    input.forEach (item) ->
      if item[prop]
        reg = new RegExp(value, if matchCase then '' else 'i')
        arr.push(item) if item[prop].match(reg)
    return arr
Standard