MCPcopy Create free account
hub / github.com/shoutem/ui / getScopedVariable

Method getScopedVariable

services/variableResolver.js:17–32  ·  view source on GitHub ↗
(scope, variable)

Source from the content-addressed store, hash-verified

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 )

Callers 2

resolveVariableMethod · 0.95
createScopedResolverMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected