getConditionDependencies()

in src/rules.js [179:203]


	getConditionDependencies(condition, found) {
		const type = getConditionType(condition, this.registeredRuleCondtions);

		switch (type) {
			case conditionTypes.ALL:
			case conditionTypes.ANY:
				const args = condition[type];
				(args || []).forEach(arg => {
					this.getConditionDependencies(arg, found);
				});
				break;
			case conditionTypes.NOT:
				const arg = condition[type];
				this.getConditionDependencies(arg, found);
				break;
			default:
				const params = condition[type];

				if (params && params.fieldPath) {
					found.add(params.fieldPath);
				}

				break;
		}
	}