json-as 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
File without changes
package/as-pect.config.js CHANGED
File without changes
package/asconfig.json CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
package/assembly/chars.ts CHANGED
File without changes
package/assembly/index.ts CHANGED
@@ -171,7 +171,8 @@ function parseNumber<T>(data: string): T {
171
171
  export function parseObject<T>(data: string): T {
172
172
  let schema!: T;
173
173
  const result = new Map<string, string>();
174
- let key: usize = 0;
174
+ let key = "";
175
+ let isKey = false;
175
176
  let depth = 1;
176
177
  let char = 0;
177
178
  for (
@@ -194,11 +195,11 @@ export function parseObject<T>(data: string): T {
194
195
  if (depth === 1) {
195
196
  ++arrayValueIndex;
196
197
  result.set(
197
- changetype<string>(key),
198
+ key,
198
199
  data.slice(outerLoopIndex, arrayValueIndex)
199
200
  );
200
201
  outerLoopIndex = arrayValueIndex;
201
- key = 0;
202
+ isKey = false;
202
203
  break;
203
204
  }
204
205
  }
@@ -217,11 +218,11 @@ export function parseObject<T>(data: string): T {
217
218
  if (depth === 1) {
218
219
  ++objectValueIndex;
219
220
  result.set(
220
- changetype<string>(key),
221
+ key,
221
222
  data.slice(outerLoopIndex, objectValueIndex)
222
223
  );
223
224
  outerLoopIndex = objectValueIndex;
224
- key = 0;
225
+ isKey = false;
225
226
  break;
226
227
  }
227
228
  }
@@ -237,16 +238,15 @@ export function parseObject<T>(data: string): T {
237
238
  char === quoteCode &&
238
239
  unsafeCharCodeAt(data, stringValueIndex - 1) !== backSlashCode
239
240
  ) {
240
- if (key === 0) {
241
- key = changetype<usize>(
242
- data.slice(outerLoopIndex, stringValueIndex)
243
- );
241
+ if (isKey === false) {
242
+ key = data.slice(outerLoopIndex, stringValueIndex);
243
+ isKey = true;
244
244
  } else {
245
245
  result.set(
246
- changetype<string>(key),
246
+ key,
247
247
  data.slice(outerLoopIndex, stringValueIndex)
248
248
  );
249
- key = 0;
249
+ isKey = false;
250
250
  }
251
251
  outerLoopIndex = ++stringValueIndex;
252
252
  break;
@@ -258,8 +258,8 @@ export function parseObject<T>(data: string): T {
258
258
  unsafeCharCodeAt(data, ++outerLoopIndex) === "u".charCodeAt(0) &&
259
259
  unsafeCharCodeAt(data, ++outerLoopIndex) === eCode
260
260
  ) {
261
- result.set(changetype<string>(key), "true");
262
- key = 0;
261
+ result.set(key, "true");
262
+ isKey = false;
263
263
  } else if (
264
264
  char === fCode &&
265
265
  unsafeCharCodeAt(data, ++outerLoopIndex) === "a".charCodeAt(0) &&
@@ -267,8 +267,8 @@ export function parseObject<T>(data: string): T {
267
267
  unsafeCharCodeAt(data, ++outerLoopIndex) === "s".charCodeAt(0) &&
268
268
  unsafeCharCodeAt(data, ++outerLoopIndex) === eCode
269
269
  ) {
270
- result.set(changetype<string>(key), "false");
271
- key = 0;
270
+ result.set(key, "false");
271
+ isKey = false;
272
272
  } else if (char >= 48 && char <= 57) {
273
273
  let numberValueIndex = ++outerLoopIndex;
274
274
  for (; numberValueIndex < data.length - 1; numberValueIndex++) {
@@ -279,11 +279,11 @@ export function parseObject<T>(data: string): T {
279
279
  numberValueIndex == data.length - 2
280
280
  ) {
281
281
  result.set(
282
- changetype<string>(key),
282
+ key,
283
283
  data.slice(outerLoopIndex - 1, numberValueIndex)
284
284
  );
285
285
  outerLoopIndex = numberValueIndex;
286
- key = 0;
286
+ isKey = false;
287
287
  break;
288
288
  }
289
289
  }
package/assembly/test.ts CHANGED
File without changes
File without changes
package/assembly/util.ts CHANGED
File without changes
package/index.ts CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "json-as",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "JSON encoder/decoder for AssemblyScript",
5
5
  "types": "assembly/index.ts",
6
6
  "author": "Jairus Tanaka",
package/tests/index.js CHANGED
File without changes
package/tests/test.js CHANGED
File without changes
File without changes
@@ -1,6 +1,6 @@
1
- {
1
+ 7{
2
2
  "name": "@json-as/transform",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "JSON encoder/decoder for AssemblyScript",
5
5
  "main": "./lib/index.js",
6
6
  "author": "Jairus Tanaka",
File without changes
File without changes
File without changes