(scope, variable)
| 15 | } |
| 16 | |
| 17 | getScopedVariable(scope, variable) { |
| 18 | if (!this.variables || _.isEmpty(this.variables)) { |
| 19 | throw new Error( |
| 20 | 'Theme variable resolver not yet initialised. Please call `setVariables` prior to this function call', |
| 21 | ); |
| 22 | } |
| 23 | |
| 24 | const scopePath = _.split(scope, '.'); |
| 25 | const variablePath = _.split(variable, '.'); |
| 26 | |
| 27 | return _.get( |
| 28 | this.variables, |
| 29 | [...scopePath, ...variablePath], |
| 30 | _.get(this.variables, variablePath) |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | // Currently supports 2 function signatures |
| 35 | // resolveVariable(variableName) -> Tries to get the variable under the root scope ( generic theme values ) |
no outgoing calls
no test coverage detected