Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
pathAny: function(resp, expected, argument) {
var results = jmespath.search(resp.data, argument);
if (!Array.isArray(results)) results = [results];
var numResults = results.length;
for (var ind = 0 ; ind < numResults; ind++) {
if (jmespath.strictDeepEqual(results[ind], expected)) {
return true;
}
}
return false;
},
path: function(resp, expected, argument) {
var result = jmespath.search(resp.data, argument);
return jmespath.strictDeepEqual(result,expected);
},
pathAny: function(resp, expected, argument) {
try {
var results = jmespath.search(resp.data, argument);
} catch (err) {
return false;
}
if (!Array.isArray(results)) results = [results];
var numResults = results.length;
for (var ind = 0 ; ind < numResults; ind++) {
if (jmespath.strictDeepEqual(results[ind], expected)) {
return true;
}
}
return false;
},
pathAll: function(resp, expected, argument) {
var results = jmespath.search(resp.data, argument);
if (!Array.isArray(results)) results = [results];
var numResults = results.length;
if (!numResults) return false;
for (var ind = 0 ; ind < numResults; ind++) {
if (!jmespath.strictDeepEqual(results[ind], expected)) {
return false;
}
}
return true;
},
pathAll: function(resp, expected, argument) {
try {
var results = jmespath.search(resp.data, argument);
} catch (err) {
return false;
}
if (!Array.isArray(results)) results = [results];
var numResults = results.length;
if (!numResults) return false;
for (var ind = 0 ; ind < numResults; ind++) {
if (!jmespath.strictDeepEqual(results[ind], expected)) {
return false;
}
}
return true;
},
path: function(resp, expected, argument) {
try {
var result = jmespath.search(resp.data, argument);
} catch (err) {
return false;
}
return jmespath.strictDeepEqual(result,expected);
},