10 examples of 'lodash array contains' in JavaScript

Every line of 'lodash array contains' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
131export function array_contains<T>(array: T[], item: T): boolean {
132 return array.indexOf(item) !== -1;
133}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

1function contains(arr, o) {
2 if (usages === null || usages === undefined) {
3 return false;
4 }
5 var l = arr.length;
6 for (var i = 0; i < l; i++) {
7 if (arr[i] === o) {
8 return true;
9 }
10 }
11 return false;
12}
233function contains(array, value) {
234 for (var i = array.length; i--;)
235 if (array[i].toString() === value)
236 return true;
237 return false;
238}
224function contains(array, value) {
225 for (var i = array.length; i--;)
226 if (array[i] == value) return true;
227 return false;
228}
11function contains(array, value) {
12 for(var i = array.length-1; i >= 0; i--) {
13 if(array[i] === value) {
14 return true;
15 }
16 }
17
18 return false;
19}
581export function contains (array, item) {
582 return array.indexOf(item) !== -1
583}
91function contains(arr, value) {
92 var i = arr.length;
93 while (i--) {
94 if (arr[i].inviteeUserName == value) return true;
95 }
96 return false;
97}
10function contains(srcArr, predicate) {
11 return indexOf(srcArr, predicate) > -1;
12}
1191function contains(array, item) {
1192 return array.indexOf(item) !== -1;
1193}
12function arrayContains(arr, item) {
13 for (var i = 0; i < arr.length; i++) {
14 if (arr[i] === item) {
15 return true;
16 }
17 }
18 return false;
19}

Related snippets