Sha256: d9c48228ebfed81d479e04dc7f0f1f0132bbacc8224e49f60c9b781637b405ad

Contents?: true

Size: 605 Bytes

Versions: 1

Compression:

Stored size: 605 Bytes

Contents

angular.module('EssayApp.filters')
       .filter 'propsFilter', ->
  (items, props) ->
    out = []
    if angular.isArray(items)
      items.forEach (item) ->
        itemMatches = false
        keys = Object.keys(props)
        i = 0

        while i < keys.length
          prop = keys[i]
          text = props[prop].toLowerCase()
          if item[prop].toString().toLowerCase().indexOf(text) isnt -1
            itemMatches = true
            break
          i++
        out.push item  if itemMatches
        return

    else
      # Let the output be the input untouched
      out = items
    out

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/assets/javascripts/app/filters/props_filter.js.coffee