all files / keystone/fields/utils/ evalDependsOn.js

87.5% Statements 7/8
75% Branches 3/4
100% Functions 2/2
87.5% Lines 7/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16                  
var ExMatch = require('expression-match');
 
function isObject (arg) {
	return Object.prototype.toString.call(arg) === '[object Object]';
};
 
module.exports = function evalDependsOn (dependsOn, values) {
	Iif (!isObject(dependsOn) || !Object.keys(dependsOn).length) {
		return true;
	}
 
	var Match = new ExMatch(dependsOn, values, false);
	return Match.match();
 
};