Every line of 'jquery array filter' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
45 function filterArrayObject(array, filter){ 46 var i = 0; 47 48 // array.length is changing 49 for(; i < array.length; i ++){ 50 if(!filter.call(array, array[i], i)){ 51 52 // the member at the iterator has been removed, so we should move the iterator one step to the left 53 array.splice(i --, 1); 54 } 55 } 56 57 return array; 58 };
19 function filterArray(arr, filter) { 20 var rtn = []; 21 for (var i = 0; i < arr.length; i++) { 22 if (filter.indexOf(i) > -1) { 23 rtn.push(arr[i]); 24 } 25 } 26 return rtn; 27 }
82 function filterUnique(array) { 83 return array.filter((value, idx) => array.indexOf(value) === idx) 84 }
13 function filter( array, term ) { 14 var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" ); 15 return $.grep( array, function (value_) { 16 return matcher.test( $( "<div>" ).html( value_.label || value_.value || value_ ).text() ); 17 }); 18 }</div>
165 function filter(arr, func) { 166 if (arr.filter) { 167 return arr.filter(func); 168 } 169 170 var result = [ ]; 171 for (var i = 0, c = arr.length; i < c; i++) { 172 if (func.call(null, arr[i], i, arr)) { 173 result.push(arr[i]); 174 } 175 } 176 177 return result; 178 }
9 function filter(array, exp) { 10 11 if(!isArray(array) || isUndefined(exp)) { 12 return array; 13 } 14 15 return array.filter(function(elm) { 16 return (isObject(elm) || isFunction(exp)) 17 ? $parse(exp)(elm) 18 : elm === exp; 19 }); 20 }
53 function filter(array, condition) { 54 var emptyArray = [] 55 array.forEach(function(element) { 56 if (condition(element)) 57 emptyArray.push(element) 58 }) 59 60 return emptyArray 61 }
15 function uniqueFilter(value, index, array) { 16 return array.indexOf(value) === index; 17 }
3 function filterItems(array) { 4 return array.filter(e => e.constructor.hasLitItemMixin); 5 }
9 static filter(arr, func) { 10 const res = []; 11 for (let item of arr) if (func(item)) res.push(item); 12 return res; 13 }