token-types
Advanced tools
+1
-4
| import type { IToken, IGetToken } from '@tokenizer/token'; | ||
| /** | ||
| * 8-bit unsigned integer | ||
| */ | ||
| export declare const UINT8: IToken<number>; | ||
@@ -128,3 +125,3 @@ /** | ||
| len: number; | ||
| private textDecoder; | ||
| private encoding?; | ||
| constructor(len: number, encoding?: string); | ||
@@ -131,0 +128,0 @@ get(data: Uint8Array, offset?: number): string; |
+4
-4
| import * as ieee754 from 'ieee754'; | ||
| import { TextDecoder } from "@kayahr/text-encoding"; | ||
| import { textDecode } from "@borewit/text-codec"; | ||
| // Primitive types | ||
@@ -7,3 +7,3 @@ function dv(array) { | ||
| } | ||
| /** | ||
| /* | ||
| * 8-bit unsigned integer | ||
@@ -387,7 +387,7 @@ */ | ||
| this.len = len; | ||
| this.textDecoder = new TextDecoder(encoding); | ||
| this.encoding = encoding; | ||
| } | ||
| get(data, offset = 0) { | ||
| const bytes = data.subarray(offset, offset + this.len); | ||
| return this.textDecoder.decode(bytes); | ||
| return textDecode(bytes, this.encoding); | ||
| } | ||
@@ -394,0 +394,0 @@ } |
+2
-2
| { | ||
| "name": "token-types", | ||
| "version": "6.1.0", | ||
| "version": "6.1.1", | ||
| "description": "Common token types for decoding and encoding numeric and string values", | ||
@@ -61,3 +61,3 @@ "author": { | ||
| "dependencies": { | ||
| "@kayahr/text-encoding": "^2.0.1", | ||
| "@borewit/text-codec": "^0.1.0", | ||
| "@tokenizer/token": "^0.3.0", | ||
@@ -64,0 +64,0 @@ "ieee754": "^1.2.1" |
+1
-3
@@ -94,6 +94,4 @@ [](https://github.com/Borewit/token-types/actions/workflows/nodejs-ci.yml?query=branch%3Amaster) | ||
| StringType decoding is using [@kayahr/text-encoding](https://github.com/kayahr/text-encoding). | ||
| StringType decoding is using [@borewit/text-codec](https://github.com/Borewit/text-codec). | ||
| Check out [Supported encodings](https://github.com/kayahr/text-encoding?tab=readme-ov-file#supported-encodings) for a complete list. | ||
| ### Custom tokens | ||
@@ -100,0 +98,0 @@ |
22012
-0.89%536
-0.56%121
-1.63%+ Added
+ Added
- Removed
- Removed