Spaces:
Paused
Paused
UserSyncFrontend / node_modules /@plotly /mapbox-gl /src /style-spec /expression /definitions /var.js
Download node_modules/@plotly/mapbox-gl/src/style-spec/expression/definitions/var.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 1.28 kB
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/expression/definitions/var.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/style-spec/expression/definitions/var.js
-
curl -L -o var.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/expression/definitions/var.js
1.28 kB
| // @flow | |
| import type {Type} from '../types'; | |
| import type {Expression} from '../expression'; | |
| import type ParsingContext from '../parsing_context'; | |
| import type EvaluationContext from '../evaluation_context'; | |
| class Var implements Expression { | |
| type: Type; | |
| name: string; | |
| boundExpression: Expression; | |
| constructor(name: string, boundExpression: Expression) { | |
| this.type = boundExpression.type; | |
| this.name = name; | |
| this.boundExpression = boundExpression; | |
| } | |
| static parse(args: $ReadOnlyArray<mixed>, context: ParsingContext) { | |
| if (args.length !== 2 || typeof args[1] !== 'string') | |
| return context.error(`'var' expression requires exactly one string literal argument.`); | |
| const name = args[1]; | |
| if (!context.scope.has(name)) { | |
| return context.error(`Unknown variable "${name}". Make sure "${name}" has been bound in an enclosing "let" expression before using it.`, 1); | |
| } | |
| return new Var(name, context.scope.get(name)); | |
| } | |
| evaluate(ctx: EvaluationContext) { | |
| return this.boundExpression.evaluate(ctx); | |
| } | |
| eachChild() {} | |
| outputDefined() { | |
| return false; | |
| } | |
| serialize() { | |
| return ["var", this.name]; | |
| } | |
| } | |
| export default Var; | |