flipr
Version:
Feature flipping and configuration using yaml files, etcd, or other flipr sources
19 lines (16 loc) • 487 B
JavaScript
const includes = require('lodash.includes');
const prepForComparison = require('./prep-for-comparison');
function executeRuleIncludes(input, rule, values) {
const firstMatch = values.find((value) => {
let property = value[rule.property];
if (property === undefined) {
return;
}
property = prepForComparison(property, rule);
return includes(input, property);
});
if (firstMatch) {
return firstMatch.value;
}
}
module.exports = executeRuleIncludes;