2
2
// SPDX-License-Identifier: MIT
3
3
// Copyright (c) vis.gl contributors
4
4
5
- import { JSONConfiguration } from './json-configuration' ;
6
- import { FUNCTION_IDENTIFIER , CONSTANT_IDENTIFIER , FUNCTION_KEY } from './syntactic-sugar' ;
7
- import { instantiateClass } from './helpers/instantiate-class' ;
8
- import { executeFunction } from './helpers/execute-function' ;
5
+ import { JSONConfiguration } from './json-configuration' ;
6
+ import { FUNCTION_IDENTIFIER , CONSTANT_IDENTIFIER , FUNCTION_KEY } from './syntactic-sugar' ;
7
+ import { instantiateClass } from './helpers/instantiate-class' ;
8
+ import { executeFunction } from './helpers/execute-function' ;
9
9
import { assert } from './utils/assert' ;
10
10
import { parseJSON } from './helpers/parse-json' ;
11
11
@@ -15,9 +15,9 @@ export type JSONConverterProps = JSONConfiguration & {
15
15
onJSONChange : ( ) => void ;
16
16
} ;
17
17
18
- /**
18
+ /**
19
19
* Converts JSON to "props" by "hydrating" classes, resolving enums and functions etc.
20
- *
20
+ *
21
21
* Lightly processes `json` props, transform string values, and extract `views` and `layers`
22
22
* @see https://github.com/visgl/deck.gl/blob/master/dev-docs/RFCs/v6.1/json-layers-rfc.md
23
23
*
@@ -30,7 +30,7 @@ export type JSONConverterProps = JSONConfiguration & {
30
30
export class JSONConverter {
31
31
log = console ; // eslint-disable-line
32
32
configuration ! : JSONConfiguration ;
33
- onJSONChange = ( ) => { } ;
33
+ onJSONChange = ( ) => { } ;
34
34
json = null ;
35
35
convertedJson = null ;
36
36
@@ -39,7 +39,7 @@ export class JSONConverter {
39
39
}
40
40
41
41
// eslint-disable-next-line @typescript-eslint/no-empty-function
42
- finalize ( ) { }
42
+ finalize ( ) { }
43
43
44
44
setProps ( props : JSONConverterProps ) {
45
45
// HANDLE CONFIGURATION PROPS
@@ -122,18 +122,18 @@ function convertJSONRecursively(json, key, configuration) {
122
122
123
123
/** Returns true if an object has a `type` field */
124
124
function isClassInstance ( json , configuration ) {
125
- const { typeKey } = configuration ;
125
+ const { typeKey} = configuration ;
126
126
const isClass = isObject ( json ) && Boolean ( json [ typeKey ] ) ;
127
127
return isClass ;
128
128
}
129
129
130
130
function convertClassInstance ( json , configuration ) {
131
131
// Extract the class type field
132
- const { typeKey } = configuration ;
132
+ const { typeKey} = configuration ;
133
133
const type = json [ typeKey ] ;
134
134
135
135
// Prepare a props object and ensure all values have been converted
136
- let props = { ...json } ;
136
+ let props = { ...json } ;
137
137
delete props [ typeKey ] ;
138
138
139
139
props = convertPlainObject ( props , configuration ) ;
@@ -144,11 +144,11 @@ function convertClassInstance(json, configuration) {
144
144
/** Plain JS object, embed functions. */
145
145
function convertFunctionObject ( json , configuration ) {
146
146
// Extract the target function field
147
- const { functionKey } = configuration ;
147
+ const { functionKey} = configuration ;
148
148
const targetFunction = json [ functionKey ] ;
149
149
150
150
// Prepare a props object and ensure all values have been converted
151
- let props = { ...json } ;
151
+ let props = { ...json } ;
152
152
delete props [ functionKey ] ;
153
153
154
154
props = convertPlainObject ( props , configuration ) ;
0 commit comments