@@ -23,7 +23,7 @@ import utf8 from "./utf8";
23
23
import { Integer , int } from "../integer" ;
24
24
25
25
let MAX_CHUNK_SIZE = 16383 ,
26
- TINY_TEXT = 0x80 ,
26
+ TINY_STRING = 0x80 ,
27
27
TINY_LIST = 0x90 ,
28
28
TINY_MAP = 0xA0 ,
29
29
TINY_STRUCT = 0xB0 ,
@@ -35,9 +35,9 @@ INT_8 = 0xC8,
35
35
INT_16 = 0xC9 ,
36
36
INT_32 = 0xCA ,
37
37
INT_64 = 0xCB ,
38
- TEXT_8 = 0xD0 ,
39
- TEXT_16 = 0xD1 ,
40
- TEXT_32 = 0xD2 ,
38
+ STRING_8 = 0xD0 ,
39
+ STRING_16 = 0xD1 ,
40
+ STRING_32 = 0xD2 ,
41
41
LIST_8 = 0xD4 ,
42
42
LIST_16 = 0xD5 ,
43
43
LIST_32 = 0xD6 ,
@@ -158,19 +158,19 @@ class Packer {
158
158
let bytes = utf8 . encode ( x ) ;
159
159
let size = bytes . length ;
160
160
if ( size < 0x10 ) {
161
- this . _ch . writeUInt8 ( TINY_TEXT | size ) ;
161
+ this . _ch . writeUInt8 ( TINY_STRING | size ) ;
162
162
this . _ch . writeBytes ( bytes ) ;
163
163
} else if ( size < 0x100 ) {
164
- this . _ch . writeUInt8 ( TEXT_8 )
164
+ this . _ch . writeUInt8 ( STRING_8 )
165
165
this . _ch . writeUInt8 ( size ) ;
166
166
this . _ch . writeBytes ( bytes ) ;
167
167
} else if ( size < 0x10000 ) {
168
- this . _ch . writeUInt8 ( TEXT_16 ) ;
168
+ this . _ch . writeUInt8 ( STRING_16 ) ;
169
169
this . _ch . writeUInt8 ( size / 256 >> 0 ) ;
170
170
this . _ch . writeUInt8 ( size % 256 ) ;
171
171
this . _ch . writeBytes ( bytes ) ;
172
172
} else if ( size < 0x100000000 ) {
173
- this . _ch . writeUInt8 ( TEXT_32 ) ;
173
+ this . _ch . writeUInt8 ( STRING_32 ) ;
174
174
this . _ch . writeUInt8 ( ( size / 16777216 >> 0 ) % 256 ) ; // TODO: Why is it shifting by 0 here?
175
175
this . _ch . writeUInt8 ( ( size / 65536 >> 0 ) % 256 ) ;
176
176
this . _ch . writeUInt8 ( ( size / 256 >> 0 ) % 256 ) ;
@@ -306,11 +306,11 @@ class Unpacker {
306
306
let high = buffer . readInt32 ( ) ;
307
307
let low = buffer . readUInt32 ( ) ;
308
308
return new Integer ( low , high ) ;
309
- } else if ( marker == TEXT_8 ) {
309
+ } else if ( marker == STRING_8 ) {
310
310
return utf8 . decode ( buffer , buffer . readUInt8 ( ) ) ;
311
- } else if ( marker == TEXT_16 ) {
311
+ } else if ( marker == STRING_16 ) {
312
312
return utf8 . decode ( buffer , buffer . readUInt16 ( ) ) ;
313
- } else if ( marker == TEXT_32 ) {
313
+ } else if ( marker == STRING_32 ) {
314
314
return utf8 . decode ( buffer , buffer . readUInt32 ( ) ) ;
315
315
} else if ( marker == LIST_8 ) {
316
316
return this . unpackList ( buffer . readUInt8 ( ) , buffer ) ;
0 commit comments