@@ -23,7 +23,7 @@ import utf8 from "./utf8";
2323import { Integer , int } from "../integer" ;
2424
2525let MAX_CHUNK_SIZE = 16383 ,
26- TINY_TEXT = 0x80 ,
26+ TINY_STRING = 0x80 ,
2727TINY_LIST = 0x90 ,
2828TINY_MAP = 0xA0 ,
2929TINY_STRUCT = 0xB0 ,
@@ -35,9 +35,9 @@ INT_8 = 0xC8,
3535INT_16 = 0xC9 ,
3636INT_32 = 0xCA ,
3737INT_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 ,
4141LIST_8 = 0xD4 ,
4242LIST_16 = 0xD5 ,
4343LIST_32 = 0xD6 ,
@@ -158,19 +158,19 @@ class Packer {
158158 let bytes = utf8 . encode ( x ) ;
159159 let size = bytes . length ;
160160 if ( size < 0x10 ) {
161- this . _ch . writeUInt8 ( TINY_TEXT | size ) ;
161+ this . _ch . writeUInt8 ( TINY_STRING | size ) ;
162162 this . _ch . writeBytes ( bytes ) ;
163163 } else if ( size < 0x100 ) {
164- this . _ch . writeUInt8 ( TEXT_8 )
164+ this . _ch . writeUInt8 ( STRING_8 )
165165 this . _ch . writeUInt8 ( size ) ;
166166 this . _ch . writeBytes ( bytes ) ;
167167 } else if ( size < 0x10000 ) {
168- this . _ch . writeUInt8 ( TEXT_16 ) ;
168+ this . _ch . writeUInt8 ( STRING_16 ) ;
169169 this . _ch . writeUInt8 ( size / 256 >> 0 ) ;
170170 this . _ch . writeUInt8 ( size % 256 ) ;
171171 this . _ch . writeBytes ( bytes ) ;
172172 } else if ( size < 0x100000000 ) {
173- this . _ch . writeUInt8 ( TEXT_32 ) ;
173+ this . _ch . writeUInt8 ( STRING_32 ) ;
174174 this . _ch . writeUInt8 ( ( size / 16777216 >> 0 ) % 256 ) ; // TODO: Why is it shifting by 0 here?
175175 this . _ch . writeUInt8 ( ( size / 65536 >> 0 ) % 256 ) ;
176176 this . _ch . writeUInt8 ( ( size / 256 >> 0 ) % 256 ) ;
@@ -306,11 +306,11 @@ class Unpacker {
306306 let high = buffer . readInt32 ( ) ;
307307 let low = buffer . readUInt32 ( ) ;
308308 return new Integer ( low , high ) ;
309- } else if ( marker == TEXT_8 ) {
309+ } else if ( marker == STRING_8 ) {
310310 return utf8 . decode ( buffer , buffer . readUInt8 ( ) ) ;
311- } else if ( marker == TEXT_16 ) {
311+ } else if ( marker == STRING_16 ) {
312312 return utf8 . decode ( buffer , buffer . readUInt16 ( ) ) ;
313- } else if ( marker == TEXT_32 ) {
313+ } else if ( marker == STRING_32 ) {
314314 return utf8 . decode ( buffer , buffer . readUInt32 ( ) ) ;
315315 } else if ( marker == LIST_8 ) {
316316 return this . unpackList ( buffer . readUInt8 ( ) , buffer ) ;
0 commit comments