| Conditions | 9 |
| Paths | 9 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | (function () { |
||
| 13 | return function (credentials, filter) { |
||
| 14 | var _credentials = []; |
||
| 15 | if (credentials) { |
||
| 16 | if(!filter){ |
||
| 17 | return credentials; |
||
| 18 | } |
||
| 19 | if (filter.filterText.trim() === "") { |
||
| 20 | return credentials; |
||
| 21 | } |
||
| 22 | |||
| 23 | for (var ci = 0; ci < credentials.length; ci++) { |
||
| 24 | var c = credentials[ci]; |
||
| 25 | for (var f = 0; f < filter.fields.length; f++) { |
||
| 26 | var field = filter.fields[f]; |
||
| 27 | if (typeof c[field] === 'string') { |
||
| 28 | if (c[field].toLowerCase().indexOf(filter.filterText.toLowerCase()) >= 0) { |
||
| 29 | _credentials.push(c); |
||
| 30 | break; |
||
| 31 | } |
||
| 32 | } else { |
||
| 33 | var t = JSON.stringify(c[field]); |
||
| 34 | if (t.indexOf(filter.filterText) >= 0) { |
||
| 35 | _credentials.push(c); |
||
| 36 | break; |
||
| 37 | } |
||
| 38 | } |
||
| 39 | } |
||
| 40 | } |
||
| 41 | return _credentials; |
||
| 42 | } else { |
||
| 43 | return []; |
||
| 44 | } |
||
| 45 | }; |
||
| 46 | }); |
||
| 47 | }()); |