10 examples of 'check if value exists in object javascript' in JavaScript

Every line of 'check if value exists in object javascript' 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
81function valueExists(value: any) {
82 return value != null;
83}
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

37function hasKey(dict, javaScriptString) {
38 if (javaScriptString === '__proto__') {
39 return (typeof dict.proto !== 'undefined');
40 } else {
41 return (typeof dict.normalKeys[javaScriptString] !== 'undefined');
42 }
43}
19function objectKeyExist(object)
20{
21 return _.some(object, function (o) {
22 return !_.isEmpty(_.pick(o, ['customer', 'cart']));
23 })
24}
11function exists(val) { return val !== null && val !== undefined }
117function existsValidatorCheckNull(value) {
118 return value != null;
119}
171function _PropertyExist(name, obj) {
172 var _propname = name.toUpperCase();
173 for (var prop in obj) {
174 if (obj.hasOwnProperty(prop)) {
175 if (prop.toUpperCase() == _propname) {
176 return true;
177 }
178 }
179 }
180 return false;
181}
203private static checkValue(value: any): void {
204 if (value === undefined) {
205 throw new Error("Value is undefined");
206 }
207}
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}
1208function isMatch( obj, key, value ) {
1209 return obj[ key ] && obj[ key ] === value;
1210}
4function exists(obj, prop) {
5 return !_.isUndefined(obj[prop]);
6}

Related snippets