| 19 | }; |
| 20 | |
| 21 | function proxyContext(context) { |
| 22 | return new Proxy(context, { |
| 23 | get(obj, prop) { |
| 24 | if (prop in obj) { |
| 25 | return obj[prop]; |
| 26 | } |
| 27 | |
| 28 | const newContext = proxyContext(context._clone()); |
| 29 | |
| 30 | if (prop in availableModifiers) { |
| 31 | return newContext._applyModifier(availableModifiers[prop], prop); |
| 32 | } |
| 33 | if (prop in customRules) { |
| 34 | return newContext._applyRule(customRules[prop], prop); |
| 35 | } |
| 36 | if (prop in availableRules) { |
| 37 | return newContext._applyRule(availableRules[prop], prop); |
| 38 | } |
| 39 | }, |
| 40 | }); |
| 41 | } |
| 42 | |
| 43 | function proxylessContext(context) { |
| 44 | const addRuleSet = (ruleSet, targetContext) => { |