Spaces:
Paused
Paused
Download node_modules/@plotly/mapbox-gl/src/style-spec/expression/scope.js from Leon4gr45/UserSyncFrontend: direct link, hf CLI and curl.
- Browser
- Download file 950 Bytes
-
https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/expression/scope.js
- Command line
-
hf download hf://spaces/Leon4gr45/UserSyncFrontend/node_modules/@plotly/mapbox-gl/src/style-spec/expression/scope.js
-
curl -L -o scope.js https://huggingface.co/spaces/Leon4gr45/UserSyncFrontend/resolve/main/node_modules/%40plotly/mapbox-gl/src/style-spec/expression/scope.js
950 Bytes
| // @flow | |
| import type {Expression} from './expression'; | |
| /** | |
| * Tracks `let` bindings during expression parsing. | |
| * @private | |
| */ | |
| class Scope { | |
| parent: ?Scope; | |
| bindings: {[_: string]: Expression}; | |
| constructor(parent?: Scope, bindings: Array<[string, Expression]> = []) { | |
| this.parent = parent; | |
| this.bindings = {}; | |
| for (const [name, expression] of bindings) { | |
| this.bindings[name] = expression; | |
| } | |
| } | |
| concat(bindings: Array<[string, Expression]>) { | |
| return new Scope(this, bindings); | |
| } | |
| get(name: string): Expression { | |
| if (this.bindings[name]) { return this.bindings[name]; } | |
| if (this.parent) { return this.parent.get(name); } | |
| throw new Error(`${name} not found in scope.`); | |
| } | |
| has(name: string): boolean { | |
| if (this.bindings[name]) return true; | |
| return this.parent ? this.parent.has(name) : false; | |
| } | |
| } | |
| export default Scope; | |