Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- rootApp.filter('customerPassengerFilter', function() {
- // return function(arr, searchString) {
- // if (!searchString) {
- // return arr;
- // }
- // function _findWord(word, str) {
- // str.split(' ').some(function(w) {
- // word.split(' ').some(function(s) {
- // return w === s;
- // });
- // });
- // }
- // console.log( arr.filter(function(filter){
- // _findWord(searchString, filter.reference_id)
- // }));
- // };
- return function(arr, searchString) {
- if (!arr) {
- return searchString;
- }
- var searchRegex = new RegExp(searchString, 'i');
- return arr.filter(function(item, index) {
- return searchRegex.test(item.reference_id);
- // если не найдено reference_id искать в объектах массива item.passengers с ключем
- // item.passengers[0].given_name item.passengers[1].given_name итд;
- });
- };
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement