10 examples of 'javascript check if value exists in array of objects' in JavaScript

Every line of 'javascript check if value exists in array of objects' 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
177function isValueInArrayOfObjects(selected, key, value) {
178 if (!Array.isArray(selected)) {
179 return selected[key] === value;
180 }
181 for (var _i = 0, selected_1 = selected; _i < selected_1.length; _i++) {
182 var s = selected_1[_i];
183 if (s && s[key] && s[key] === value) {
184 return true;
185 }
186 }
187 return false;
188}
81function valueExists(value: any) {
82 return value != null;
83}
12function isInArray(value) {
13 return value !== undefined;
14}
30function isInArray(value, array) {
31 return array.indexOf(value) > -1;
32}//isInArray
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}
233function contains(array, value) {
234 for (var i = array.length; i--;)
235 if (array[i].toString() === value)
236 return true;
237 return false;
238}
75function ՐՏ_in(val, arr) {
76 if (Array.isArray(arr) || typeof arr === "string") {
77 return arr.indexOf(val) !== -1;
78 } else {
79 if (arr.hasOwnProperty(val)) {
80 return true;
81 }
82 return false;
83 }
84}
113export function isJsonObject(value: JsonValue): value is JsonObject {
114 return value != null && typeof value === 'object' && !Array.isArray(value);
115}
19function objectKeyExist(object)
20{
21 return _.some(object, function (o) {
22 return !_.isEmpty(_.pick(o, ['customer', 'cart']));
23 })
24}

Related snippets