Moved a lot of functionality to mixins, improved parenting

This commit is contained in:
Stefan Zermatten
2019-03-19 15:57:21 +02:00
parent 1146d56324
commit 5bb5f047f4
31 changed files with 383 additions and 229 deletions

View File

@@ -0,0 +1,28 @@
import MONGO_OPERATORS from '/imports/constants/MONGO_OPERATORS.js';
const hasAny = function(values){
for (let value of values){
if (this.has(value)){
return true;
}
}
return false;
};
// Returns a Set of fields the modifier changes
// The set has been extended with the "hasAny" function
export default function getModifierFields (modifier) {
let fields = new Set();
for (let operator of MONGO_OPERATORS){
if (modifier[operator]) for (let field in modifier[operator]){
const indexOfDot = field.indexOf('.');
if (indexOfDot !== -1) {
field = field.substring(0, indexOfDot);
}
fields.add(field);
}
}
fields.hasAny = hasAny;
return fields;
}