Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return negate(a.exists(propertyValue, queryValue), isNegated);
/* query value is a regex */
} else if (queryValue instanceof RegExp){
if ([ "boolean", "string", "number" ].indexOf(typeof propertyValue) === -1){
return isNegated;
} else {
return negate(queryValue.test(propertyValue), isNegated);
}
/* query value is a function */
} else if (typeof queryValue === "function"){
return negate(queryValue(propertyValue), isNegated);
/* query and property value are objects */
} else if (t.isObject(propertyValue) && t.isObject(queryValue)){
return negate(exists(propertyValue, queryValue), isNegated);
/* query value is a primitive */
} else {
return negate(queryValue === propertyValue, isNegated);
}
});
}
} else if (queryValue instanceof RegExp){
if (!(typeof objectValue === "boolean" || typeof objectValue === "string" || typeof objectValue === "number")){
found = isNegated;
} else {
found = isNegated
? !queryValue.test(objectValue)
: queryValue.test(objectValue);
}
} else if (typeof queryValue === "function"){
found = isNegated
? !queryValue(objectValue)
: queryValue(objectValue);
} else if (t.isObject(objectValue) && t.isObject(queryValue)){
found = exists(objectValue, queryValue);
} else {
found = isNegated
? queryValue !== objectValue
: queryValue === objectValue;
}
if (!found) break;
}
return found;
}
function exists(object, query){
if (arguments.length !== 2) throw Error("expecting two args");
if (!t.isObject(object)) throw Error("input object must be an object: " + object);
if (!t.isObject(query)) throw Error("query must be an object: " + query);
return Object.keys(query).every(function(prop){
var queryValue = query[prop];
var isNegated = false;
var isContains = false;
if (prop.charAt(0) === "!"){
isNegated = true;
} else if (prop.charAt(0) === "+") {
isContains = true;
}
var propertyValue = object[(isNegated || isContains) ? prop.slice(1) : prop];
if (isContains){
queryValue = a.arrayify(queryValue);
propertyValue = a.arrayify(propertyValue);
function exists(object, query){
if (arguments.length !== 2) throw Error("expecting two args");
if (!t.isObject(object)) throw Error("input object must be an object: " + object);
if (!t.isObject(query)) throw Error("query must be an object: " + query);
return Object.keys(query).every(function(prop){
var queryValue = query[prop];
var isNegated = false;
var isContains = false;
if (prop.charAt(0) === "!"){
isNegated = true;
} else if (prop.charAt(0) === "+") {
isContains = true;
}
var propertyValue = object[(isNegated || isContains) ? prop.slice(1) : prop];
if (isContains){
queryValue = a.arrayify(queryValue);
propertyValue = a.arrayify(propertyValue);
}
function exists(object, query){
if (arguments.length !== 2) throw Error("expecting two args");
if (!t.isObject(object)) throw Error("input object must be an object: " + object);
if (!t.isObject(query)) throw Error("query must be an object: " + query);
return Object.keys(query).every(function(prop){
var queryValue = query[prop];
var isNegated = false;
var isContains = false;
if (prop.charAt(0) === "!"){
isNegated = true;
} else if (prop.charAt(0) === "+") {
isContains = true;
}
var propertyValue = object[(isNegated || isContains) ? prop.slice(1) : prop];
if (isContains){
queryValue = a.arrayify(queryValue);
propertyValue = a.arrayify(propertyValue);
}
return args.reduce(function(prev, curr){
if (typeof curr !== "object") return prev;
for (var prop in curr){
var value = curr[prop];
if (t.isObject(value) && !Array.isArray(value) && depth < 10){
if (!prev[prop]) prev[prop] = {};
prev[prop] = extend(prev[prop], value, { __depth: ++depth });
} else {
prev[prop] = value;
}
}
return prev;
}, {});
}
const data = Object.keys(object).map(key => {
if (t.isObject(object[key])) {
return { key: ansi.format(key, 'bold'), value: objectToTable(object[key]) }
} else {
return { key: ansi.format(key, 'bold'), value: object[key] }
}
})
return tableLayout(data, {