Skip to content

Commit 469b005

Browse files
committed
Use Map for constants.
1 parent bc75764 commit 469b005

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

src/x_ite/Parser/VRMLParser.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -119,33 +119,33 @@ Object .assign (Object .setPrototypeOf (VRMLParser .prototype, X3DParser .protot
119119
Vector2: new Vector2 (),
120120
Vector3: new Vector3 (),
121121
Vector4: new Vector4 (),
122-
CONSTANTS: {
123-
NAN: Number .NaN,
124-
INFINITY: Number .POSITIVE_INFINITY,
125-
INF: Number .POSITIVE_INFINITY,
126-
PI: Math .PI,
127-
PI2: Math .PI * 2,
128-
PI1_4: Math .PI * 1/4,
129-
PI2_4: Math .PI * 2/4,
130-
PI3_4: Math .PI * 3/4,
131-
PI4_4: Math .PI * 4/4,
132-
PI5_4: Math .PI * 5/4,
133-
PI6_4: Math .PI * 6/4,
134-
PI7_4: Math .PI * 7/4,
135-
PI8_4: Math .PI * 8/4,
136-
PI1_2: Math .PI * 1/2,
137-
PI2_2: Math .PI * 2/2,
138-
PI3_2: Math .PI * 3/2,
139-
PI4_2: Math .PI * 4/2,
140-
PI1_3: Math .PI * 1/3,
141-
PI2_3: Math .PI * 2/3,
142-
PI3_3: Math .PI * 3/3,
143-
PI4_3: Math .PI * 4/3,
144-
PI5_3: Math .PI * 5/3,
145-
PI6_3: Math .PI * 6/3,
146-
SQRT1_2: Math .SQRT1_2,
147-
SQRT2: Math .SQRT2,
148-
},
122+
CONSTANTS: new Map ([
123+
["NAN", Number .NaN],
124+
["INFINITY", Number .POSITIVE_INFINITY],
125+
["INF", Number .POSITIVE_INFINITY],
126+
["PI", Math .PI],
127+
["PI2", Math .PI * 2],
128+
["PI1_4", Math .PI * 1/4],
129+
["PI2_4", Math .PI * 2/4],
130+
["PI3_4", Math .PI * 3/4],
131+
["PI4_4", Math .PI * 4/4],
132+
["PI5_4", Math .PI * 5/4],
133+
["PI6_4", Math .PI * 6/4],
134+
["PI7_4", Math .PI * 7/4],
135+
["PI8_4", Math .PI * 8/4],
136+
["PI1_2", Math .PI * 1/2],
137+
["PI2_2", Math .PI * 2/2],
138+
["PI3_2", Math .PI * 3/2],
139+
["PI4_2", Math .PI * 4/2],
140+
["PI1_3", Math .PI * 1/3],
141+
["PI2_3", Math .PI * 2/3],
142+
["PI3_3", Math .PI * 3/3],
143+
["PI4_3", Math .PI * 4/3],
144+
["PI5_3", Math .PI * 5/3],
145+
["PI6_3", Math .PI * 6/3],
146+
["SQRT1_2", Math .SQRT1_2],
147+
["SQRT2", Math .SQRT2],
148+
]),
149149
unknownLevel: 0,
150150
getEncoding ()
151151
{
@@ -1556,7 +1556,7 @@ Object .assign (Object .setPrototypeOf (VRMLParser .prototype, X3DParser .protot
15561556

15571557
if (Grammar .CONSTANTS .parse (this))
15581558
{
1559-
this .value = this .CONSTANTS [this .result [2] .toUpperCase ()];
1559+
this .value = this .CONSTANTS .get (this .result [2] .toUpperCase ());
15601560

15611561
if (this .result [1] === "-")
15621562
this .value = -this .value;

0 commit comments

Comments
 (0)