File tree 5 files changed +29
-23
lines changed
5 files changed +29
-23
lines changed Original file line number Diff line number Diff line change 1
1
import { Buffer } from "./util" ;
2
2
import { JSONDecoder } from "./decoder" ;
3
3
4
-
5
4
class Handler {
6
5
stack : JSON . Value [ ] = new Array < JSON . Value > ( ) ;
7
6
@@ -79,12 +78,12 @@ class Handler {
79
78
}
80
79
}
81
80
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 ) ;
85
84
86
85
/** 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 {
88
87
var arr : Uint8Array ;
89
88
if ( isString < T > ( str ) ) {
90
89
arr = Buffer . fromString ( < string > str ) ;
Original file line number Diff line number Diff line change @@ -60,13 +60,20 @@ export class ThrowingJSONHandler extends JSONHandler {
60
60
}
61
61
}
62
62
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);
70
77
71
78
export class DecoderState {
72
79
lastKey : string = "" ;
Original file line number Diff line number Diff line change 1
1
{
2
- "extends" : " ../node_modules/ assemblyscript/std/assembly.json" ,
2
+ "extends" : " assemblyscript/std/assembly.json" ,
3
3
"include" : [
4
4
" ./**/*.ts"
5
5
]
Original file line number Diff line number Diff line change 10
10
},
11
11
"devDependencies" : {
12
12
"@as-pect/cli" : " ^4.0.0" ,
13
- "assemblyscript" : " ^0.13.3 "
13
+ "assemblyscript" : " ^0.14.9 "
14
14
}
15
15
}
Original file line number Diff line number Diff line change @@ -65,23 +65,23 @@ ansi-styles@^4.1.0:
65
65
" @types/color-name" " ^1.1.1"
66
66
color-convert "^2.0.1"
67
67
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 ==
72
72
dependencies :
73
- binaryen "93 .0.0-nightly.20200609 "
73
+ binaryen "95 .0.0-nightly.20200813 "
74
74
long "^4.0.0"
75
75
76
76
balanced-match@^1.0.0 :
77
77
version "1.0.0"
78
78
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767"
79
79
integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c=
80
80
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 ==
85
85
86
86
brace-expansion@^1.1.7 :
87
87
version "1.1.11"
You can’t perform that action at this time.
0 commit comments