1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-26 18:42:23 +02:00
TableFilter/src/array.js

16 lines
325 B
JavaScript
Raw Normal View History

2014-11-16 01:29:07 +01:00
/**
* Array utilities
*/
2016-05-20 10:08:39 +02:00
import {matchCase} from './string';
2014-11-16 01:29:07 +01:00
2016-05-20 08:58:54 +02:00
export const has = (arr, val, caseSensitive) => {
let sCase = Boolean(caseSensitive);
for (var i = 0, l = arr.length; i < l; i++) {
2016-05-20 10:08:39 +02:00
if (matchCase(arr[i].toString(), sCase) === val) {
2016-05-20 08:58:54 +02:00
return true;
2014-11-16 01:29:07 +01:00
}
}
2016-05-20 08:58:54 +02:00
return false;
}