(context)
| 41 | } |
| 42 | |
| 43 | function proxylessContext(context) { |
| 44 | const addRuleSet = (ruleSet, targetContext) => { |
| 45 | Object.keys(ruleSet).forEach(prop => { |
| 46 | targetContext[prop] = (...args) => { |
| 47 | const newContext = proxylessContext(targetContext._clone()); |
| 48 | const contextWithRuleApplied = newContext._applyRule( |
| 49 | ruleSet[prop], |
| 50 | prop, |
| 51 | )(...args); |
| 52 | return contextWithRuleApplied; |
| 53 | }; |
| 54 | }); |
| 55 | return targetContext; |
| 56 | }; |
| 57 | |
| 58 | const contextWithAvailableRules = addRuleSet(availableRules, context); |
| 59 | const contextWithAllRules = addRuleSet( |
| 60 | customRules, |
| 61 | contextWithAvailableRules, |
| 62 | ); |
| 63 | |
| 64 | Object.keys(availableModifiers).forEach(prop => { |
| 65 | Object.defineProperty(contextWithAllRules, prop, { |
| 66 | get: () => { |
| 67 | const newContext = proxylessContext(contextWithAllRules._clone()); |
| 68 | return newContext._applyModifier(availableModifiers[prop], prop); |
| 69 | }, |
| 70 | }); |
| 71 | }); |
| 72 | |
| 73 | return contextWithAllRules; |
| 74 | } |
| 75 | |
| 76 | const availableModifiers = { |
| 77 | not: { |
no test coverage detected