File tree Expand file tree Collapse file tree 5 files changed +29
-23
lines changed Expand file tree Collapse file tree 5 files changed +29
-23
lines changed Original file line number Diff line number Diff line change 11import { Buffer } from "./util" ;
22import { JSONDecoder } from "./decoder" ;
33
4-
54class Handler {
65 stack : JSON . Value [ ] = new Array < JSON . Value > ( ) ;
76
@@ -79,12 +78,12 @@ class Handler {
7978 }
8079}
8180
82- class _JSON {
83- private static handler : Handler = new Handler ( ) ;
84- private static decoder : JSONDecoder < Handler > = new JSONDecoder < Handler > ( _JSON . handler ) ;
81+ namespace _JSON {
82+ @ lazy export const handler : Handler = new Handler ( ) ;
83+ @ lazy export const decoder : JSONDecoder < Handler > = new JSONDecoder < Handler > ( _JSON . handler ) ;
8584
8685 /** Parses a string or Uint8Array and returns a Json Value. */
87- static parse < T = Uint8Array > ( str : T ) : JSON . Value {
86+ export function parse < T = Uint8Array > ( str : T ) : JSON . Value {
8887 var arr : Uint8Array ;
8988 if ( isString < T > ( str ) ) {
9089 arr = Buffer . fromString ( < string > str ) ;
Original file line number Diff line number Diff line change @@ -60,13 +60,20 @@ export class ThrowingJSONHandler extends JSONHandler {
6060 }
6161}
6262
63- const TRUE_STR = "true" ;
64- const FALSE_STR = "false" ;
65- const NULL_STR = "null" ;
66- const CHAR_0 : i32 = 48 ; //"0".charCodeAt(0);
67- const CHAR_9 : i32 = 57 ; //"9".charCodeAt(0);
68- const CHAR_A : i32 = 65 ; //"A".charCodeAt(0);
69- const CHAR_A_LOWER : i32 = 97 ; //"a".charCodeAt(0);
63+ //@ts -ignore: decorator
64+ @lazy const TRUE_STR = "true" ;
65+ //@ts -ignore: decorator
66+ @lazy const FALSE_STR = "false" ;
67+ //@ts -ignore: decorator
68+ @lazy const NULL_STR = "null" ;
69+ //@ts -ignore: decorator
70+ @lazy const CHAR_0 : i32 = 48 ; //"0".charCodeAt(0);
71+ //@ts -ignore: decorator
72+ @lazy const CHAR_9 : i32 = 57 ; //"9".charCodeAt(0);
73+ //@ts -ignore: decorator
74+ @lazy const CHAR_A : i32 = 65 ; //"A".charCodeAt(0);
75+ //@ts -ignore: decorator
76+ @lazy const CHAR_A_LOWER : i32 = 97 ; //"a".charCodeAt(0);
7077
7178export class DecoderState {
7279 lastKey : string = "" ;
Original file line number Diff line number Diff line change 11{
2- "extends" : " ../node_modules/ assemblyscript/std/assembly.json" ,
2+ "extends" : " assemblyscript/std/assembly.json" ,
33 "include" : [
44 " ./**/*.ts"
55 ]
Original file line number Diff line number Diff line change 1010 },
1111 "devDependencies" : {
1212 "@as-pect/cli" : " ^4.0.0" ,
13- "assemblyscript" : " ^0.13.3 "
13+ "assemblyscript" : " ^0.14.9 "
1414 }
1515}
Original file line number Diff line number Diff line change @@ -65,23 +65,23 @@ ansi-styles@^4.1.0:
6565 " @types/color-name" " ^1.1.1"
6666 color-convert "^2.0.1"
6767
68- assemblyscript@^0.13.3 :
69- version "0.13.8 "
70- resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.13.8 .tgz#be86486c4c178169be069b6265d70dfbab127756 "
71- integrity sha512-HOwnJd/Fs88jPuQVA1Waz/njGJfu1tPQCL4hGas3XDvap6xVQUFGxx4hCxn8kFC8kSmVC3MBgFkWz+VPTes7Bw ==
68+ assemblyscript@^0.14.9 :
69+ version "0.14.9 "
70+ resolved "https://registry.yarnpkg.com/assemblyscript/-/assemblyscript-0.14.9 .tgz#f738c228e68d52c9b5f2ca40d1614c0118b7eea2 "
71+ integrity sha512-4e67IC2hQ1XOwOp+Sz9w84y7uAMCiU4GHw0J9+A5aWeEDM0lYp8knYCRw1DCJTj1mZVLdpsD5mIIrXcmcVb+FA ==
7272 dependencies :
73- binaryen "93 .0.0-nightly.20200609 "
73+ binaryen "95 .0.0-nightly.20200813 "
7474 long "^4.0.0"
7575
7676balanced-match@^1.0.0 :
7777 version "1.0.0"
7878 resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
7979 integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
8080
81- binaryen@93 .0.0-nightly.20200609 :
82- version "93 .0.0-nightly.20200609 "
83- resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-93 .0.0-nightly.20200609 .tgz#e7c9211911c0cff94b8682e895e4de630f110cd5 "
84- integrity sha512-CIaeav05u+fWRN2h1ecwIoSaOF/Mk6U85M/G6eg1nOHAXYYmOuh9TztF9Fu8krRWnl98J3W+VfDClApMV5zCtw ==
81+ binaryen@95 .0.0-nightly.20200813 :
82+ version "95 .0.0-nightly.20200813 "
83+ resolved "https://registry.yarnpkg.com/binaryen/-/binaryen-95 .0.0-nightly.20200813 .tgz#c84b332a7b06d4a9a2096c57b29c3e889130bcfb "
84+ integrity sha512-xY+fhSAkVxptBoQAn9X4o21zTFycOjc+PeqbWSwcDqrSmXBXUMeq7qHhz4EWSWlFDKobHeUaiIbzLzlmciDWHw ==
8585
8686brace-expansion@^1.1.7 :
8787 version "1.1.11"
You can’t perform that action at this time.
0 commit comments