aboutsummaryrefslogtreecommitdiff
path: root/node_modules/token-types
diff options
context:
space:
mode:
authorMinteck <freeziv.ytb@gmail.com>2021-03-07 18:29:17 +0100
committerMinteck <freeziv.ytb@gmail.com>2021-03-07 18:29:17 +0100
commit0f79e708bf07721b73ea41e5d341be08e8ea4dce (patch)
treef3c63cd6a9f4ef0b26f95eec6a031600232e80c8 /node_modules/token-types
downloadelectrode-0f79e708bf07721b73ea41e5d341be08e8ea4dce.tar.gz
electrode-0f79e708bf07721b73ea41e5d341be08e8ea4dce.tar.bz2
electrode-0f79e708bf07721b73ea41e5d341be08e8ea4dce.zip
Initial commit
Diffstat (limited to 'node_modules/token-types')
-rw-r--r--node_modules/token-types/LICENSE7
-rw-r--r--node_modules/token-types/README.md107
-rw-r--r--node_modules/token-types/lib/index.d.ts170
-rw-r--r--node_modules/token-types/lib/index.js549
-rw-r--r--node_modules/token-types/node_modules/ieee754/LICENSE11
-rw-r--r--node_modules/token-types/node_modules/ieee754/README.md51
-rw-r--r--node_modules/token-types/node_modules/ieee754/index.d.ts10
-rw-r--r--node_modules/token-types/node_modules/ieee754/index.js85
-rw-r--r--node_modules/token-types/node_modules/ieee754/package.json84
-rw-r--r--node_modules/token-types/package.json120
10 files changed, 1194 insertions, 0 deletions
diff --git a/node_modules/token-types/LICENSE b/node_modules/token-types/LICENSE
new file mode 100644
index 0000000..ffcebb7
--- /dev/null
+++ b/node_modules/token-types/LICENSE
@@ -0,0 +1,7 @@
+Copyright 2017 Borewit
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file
diff --git a/node_modules/token-types/README.md b/node_modules/token-types/README.md
new file mode 100644
index 0000000..dcb69a8
--- /dev/null
+++ b/node_modules/token-types/README.md
@@ -0,0 +1,107 @@
+![Node.js CI](https://github.com/Borewit/token-types/workflows/Node.js%20CI/badge.svg)
+[![NPM version](https://badge.fury.io/js/token-types.svg)](https://npmjs.org/package/token-types)
+[![npm downloads](http://img.shields.io/npm/dm/token-types.svg)](https://npmcharts.com/compare/token-types,strtok3?start=1200&interval=30)
+[![coveralls](https://coveralls.io/repos/github/Borewit/token-types/badge.svg?branch=master)](https://coveralls.io/github/Borewit/token-types?branch=master)
+[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4723ce4613fc49cda8db5eed29f18834)](https://www.codacy.com/app/Borewit/token-types?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=Borewit/token-types&amp;utm_campaign=Badge_Grade)
+[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/Borewit/token-types.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/token-types/context:javascript)
+[![Total alerts](https://img.shields.io/lgtm/alerts/g/Borewit/token-types.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/Borewit/token-types/alerts/)
+[![DeepScan grade](https://deepscan.io/api/teams/5165/projects/6940/branches/61852/badge/grade.svg)](https://deepscan.io/dashboard#view=project&tid=5165&pid=6940&bid=61852)
+[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/token-types/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/token-types?targetFile=package.json)
+
+# token-types
+
+A primitive token library used to read and write from a node `Buffer`.
+Although it is possible to use this module directly, it is primary designed to be used with [strtok3 tokenizer](https://github.com/Borewit/strtok3).
+
+## Installation
+
+```sh
+npm install --save token-types
+```
+Usually in combination with [strtok3](https://github.com/Borewit/strtok3):
+```sh
+npm install --save strtok3
+```
+
+## Example
+
+```js
+const strtok3 = require('strtok3');
+const token = require('token-types');
+
+(async () => {
+
+ const tokenizer = await strtok3.fromFile("somefile.bin");
+ try {
+ const myNumber = await tokenizer.readToken(token.Float32_BE);
+ console.log(`My number: ${myNumber}`);
+ } finally {
+ tokenizer.close(); // Close the file
+ }
+})();
+```
+
+## Tokens
+
+### Numeric tokens
+
+`node-strtok` supports a wide variety of numerical tokens out of the box:
+
+| Token | Number | Bits | Endianness |
+|---------------|------------------|------|----------------|
+| `UINT8` | Unsigned integer | 8 | n/a |
+| `UINT16_BE` | Unsigned integer | 16 | big endian |
+| `UINT16_LE` | Unsigned integer | 16 | little endian |
+| `UINT24_BE` | Unsigned integer | 24 | big endian |
+| `UINT24_LE` | Unsigned integer | 24 | little endian |
+| `UINT32_BE` | Unsigned integer | 32 | big endian |
+| `UINT32_LE` | Unsigned integer | 32 | little endian |
+| `UINT64_BE` | Unsigned integer | 64 | big endian |
+| `UINT64_LE`* | Unsigned integer | 64 | little endian |
+| `INT8` | Signed integer | 8 | n/a |
+| `INT16_BE` | Signed integer | 16 | big endian |
+| `INT16_LE` | Signed integer | 16 | little endian |
+| `INT24_BE` | Signed integer | 24 | big endian |
+| `INT24_LE` | Signed integer | 24 | little endian |
+| `INT32_BE` | Signed integer | 32 | big endian |
+| `INT32_LE` | Signed integer | 32 | little endian |
+| `INT64_BE` | Signed integer | 64 | big endian |
+| `INT64_LE`* | Signed integer | 64 | little endian |
+| `Float16_BE` | IEEE 754 float | 16 | big endian |
+| `Float16_LE` | IEEE 754 float | 16 | little endian |
+| `Float32_BE` | IEEE 754 float | 32 | big endian |
+| `Float32_LE` | IEEE 754 float | 32 | little endian |
+| `Float64_BE` | IEEE 754 float | 64 | big endian |
+| `Float64_LE` | IEEE 754 float | 64 | little endian |
+| `Float80_BE`* | IEEE 754 float | 80 | big endian |
+| `Float80_LE`* | IEEE 754 float | 80 | little endian |
+
+### Other tokens
+
+String types:
+* Windows-1252
+* ISO-8859-1
+
+*) The tokens exceed the JavaScript IEEE 754 64-bit Floating Point precision, decoding and encoding is best effort based.
+
+### Custom token
+
+Complex tokens can be added, which makes very suitable for reading binary files or network messages:
+```js
+ ExtendedHeader = {
+ len: 10,
+
+ get: (buf, off) => {
+ return {
+ // Extended header size
+ size: Token.UINT32_BE.get(buf, off),
+ // Extended Flags
+ extendedFlags: Token.UINT16_BE.get(buf, off + 4),
+ // Size of padding
+ sizeOfPadding: Token.UINT32_BE.get(buf, off + 6),
+ // CRC data present
+ crcDataPresent: common.strtokBITSET.get(buf, off + 4, 31)
+ };
+ }
+ };
+```
diff --git a/node_modules/token-types/lib/index.d.ts b/node_modules/token-types/lib/index.d.ts
new file mode 100644
index 0000000..20f71c9
--- /dev/null
+++ b/node_modules/token-types/lib/index.d.ts
@@ -0,0 +1,170 @@
+/// <reference types="node" />
+import { IToken, IGetToken } from '@tokenizer/token';
+/**
+ * 8-bit unsigned integer
+ */
+export declare const UINT8: IToken<number>;
+/**
+ * 16-bit unsigned integer, Little Endian byte order
+ */
+export declare const UINT16_LE: IToken<number>;
+/**
+ * 16-bit unsigned integer, Big Endian byte order
+ */
+export declare const UINT16_BE: IToken<number>;
+/**
+ * 24-bit unsigned integer, Little Endian byte order
+ */
+export declare const UINT24_LE: IToken<number>;
+/**
+ * 24-bit unsigned integer, Big Endian byte order
+ */
+export declare const UINT24_BE: IToken<number>;
+/**
+ * 32-bit unsigned integer, Little Endian byte order
+ */
+export declare const UINT32_LE: IToken<number>;
+/**
+ * 32-bit unsigned integer, Big Endian byte order
+ */
+export declare const UINT32_BE: IToken<number>;
+/**
+ * 8-bit signed integer
+ */
+export declare const INT8: IToken<number>;
+/**
+ * 16-bit signed integer, Big Endian byte order
+ */
+export declare const INT16_BE: IToken<number>;
+/**
+ * 16-bit signed integer, Little Endian byte order
+ */
+export declare const INT16_LE: IToken<number>;
+/**
+ * 24-bit signed integer, Little Endian byte order
+ */
+export declare const INT24_LE: IToken<number>;
+/**
+ * 24-bit signed integer, Big Endian byte order
+ */
+export declare const INT24_BE: IToken<number>;
+/**
+ * 32-bit signed integer, Big Endian byte order
+ */
+export declare const INT32_BE: IToken<number>;
+/**
+ * 32-bit signed integer, Big Endian byte order
+ */
+export declare const INT32_LE: IToken<number>;
+/**
+ * 64-bit unsigned integer, Little Endian byte order
+ */
+export declare const UINT64_LE: IToken<number>;
+/**
+ * 64-bit signed integer, Little Endian byte order
+ */
+export declare const INT64_LE: IToken<number>;
+/**
+ * 64-bit unsigned integer, Big Endian byte order
+ */
+export declare const UINT64_BE: IToken<number>;
+/**
+ * 64-bit signed integer, Big Endian byte order
+ */
+export declare const INT64_BE: IToken<number>;
+/**
+ * IEEE 754 16-bit (half precision) float, big endian
+ */
+export declare const Float16_BE: IToken<number>;
+/**
+ * IEEE 754 16-bit (half precision) float, little endian
+ */
+export declare const Float16_LE: IToken<number>;
+/**
+ * IEEE 754 32-bit (single precision) float, big endian
+ */
+export declare const Float32_BE: IToken<number>;
+/**
+ * IEEE 754 32-bit (single precision) float, little endian
+ */
+export declare const Float32_LE: IToken<number>;
+/**
+ * IEEE 754 64-bit (double precision) float, big endian
+ */
+export declare const Float64_BE: IToken<number>;
+/**
+ * IEEE 754 64-bit (double precision) float, little endian
+ */
+export declare const Float64_LE: IToken<number>;
+/**
+ * IEEE 754 80-bit (extended precision) float, big endian
+ */
+export declare const Float80_BE: IToken<number>;
+/**
+ * IEEE 754 80-bit (extended precision) float, little endian
+ */
+export declare const Float80_LE: IToken<number>;
+/**
+ * Ignore a given number of bytes
+ */
+export declare class IgnoreType implements IGetToken<void> {
+ len: number;
+ /**
+ * @param len number of bytes to ignore
+ */
+ constructor(len: number);
+ get(buf: Buffer, off: number): void;
+}
+export declare class BufferType implements IGetToken<Buffer> {
+ len: number;
+ constructor(len: number);
+ get(buf: Buffer, off: number): Buffer;
+}
+/**
+ * Consume a fixed number of bytes from the stream and return a string with a specified encoding.
+ */
+export declare class StringType implements IGetToken<string> {
+ len: number;
+ encoding: BufferEncoding;
+ constructor(len: number, encoding: BufferEncoding);
+ get(buf: Buffer, off: number): string;
+}
+/**
+ * ANSI Latin 1 String
+ * Using windows-1252 / ISO 8859-1 decoding
+ */
+export declare class AnsiStringType implements IGetToken<string> {
+ len: number;
+ private static windows1252;
+ private static decode;
+ private static inRange;
+ private static codePointToString;
+ private static singleByteDecoder;
+ constructor(len: number);
+ get(buf: Buffer, off?: number): string;
+}
+/**
+ * Best effort approach to write 64 but signed integer, little endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+export declare function writeIntLE(buf: Buffer, value: number, offset: number, byteLength: number): number;
+/**
+ * Best effort approach to read up to 64 bit unsigned integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+export declare function readUIntBE(buf: Buffer, offset: number, byteLength: number): number;
+/**
+ * Best effort approach to write up to 64 bit unsigned integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+export declare function writeUIntBE(buf: Buffer, value: number, offset: number, byteLength: number): number;
+/**
+ * Best effort approach to read 64 but signed integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+export declare function readIntBE(buf: Buffer, offset: number, byteLength: number): number;
+/**
+ * Best effort approach to write 64 but signed integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+export declare function writeIntBE(buf: Buffer, value: number, offset: number, byteLength: number): number;
diff --git a/node_modules/token-types/lib/index.js b/node_modules/token-types/lib/index.js
new file mode 100644
index 0000000..38df2fb
--- /dev/null
+++ b/node_modules/token-types/lib/index.js
@@ -0,0 +1,549 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.writeIntBE = exports.readIntBE = exports.writeUIntBE = exports.readUIntBE = exports.writeIntLE = exports.AnsiStringType = exports.StringType = exports.BufferType = exports.IgnoreType = exports.Float80_LE = exports.Float80_BE = exports.Float64_LE = exports.Float64_BE = exports.Float32_LE = exports.Float32_BE = exports.Float16_LE = exports.Float16_BE = exports.INT64_BE = exports.UINT64_BE = exports.INT64_LE = exports.UINT64_LE = exports.INT32_LE = exports.INT32_BE = exports.INT24_BE = exports.INT24_LE = exports.INT16_LE = exports.INT16_BE = exports.INT8 = exports.UINT32_BE = exports.UINT32_LE = exports.UINT24_BE = exports.UINT24_LE = exports.UINT16_BE = exports.UINT16_LE = exports.UINT8 = void 0;
+const ieee754 = require("ieee754");
+// Primitive types
+/**
+ * 8-bit unsigned integer
+ */
+exports.UINT8 = {
+ len: 1,
+ get(buf, off) {
+ return buf.readUInt8(off);
+ },
+ put(buf, off, v) {
+ return buf.writeUInt8(v, off);
+ }
+};
+/**
+ * 16-bit unsigned integer, Little Endian byte order
+ */
+exports.UINT16_LE = {
+ len: 2,
+ get(buf, off) {
+ return buf.readUInt16LE(off);
+ },
+ put(buf, off, v) {
+ return buf.writeUInt16LE(v, off);
+ }
+};
+/**
+ * 16-bit unsigned integer, Big Endian byte order
+ */
+exports.UINT16_BE = {
+ len: 2,
+ get(buf, off) {
+ return buf.readUInt16BE(off);
+ },
+ put(buf, off, v) {
+ return buf.writeUInt16BE(v, off);
+ }
+};
+/**
+ * 24-bit unsigned integer, Little Endian byte order
+ */
+exports.UINT24_LE = {
+ len: 3,
+ get(buf, off) {
+ return buf.readUIntLE(off, 3);
+ },
+ put(buf, off, v) {
+ return buf.writeUIntLE(v, off, 3);
+ }
+};
+/**
+ * 24-bit unsigned integer, Big Endian byte order
+ */
+exports.UINT24_BE = {
+ len: 3,
+ get(buf, off) {
+ return buf.readUIntBE(off, 3);
+ },
+ put(buf, off, v) {
+ return buf.writeUIntBE(v, off, 3);
+ }
+};
+/**
+ * 32-bit unsigned integer, Little Endian byte order
+ */
+exports.UINT32_LE = {
+ len: 4,
+ get(buf, off) {
+ return buf.readUInt32LE(off);
+ },
+ put(b, o, v) {
+ return b.writeUInt32LE(v, o);
+ }
+};
+/**
+ * 32-bit unsigned integer, Big Endian byte order
+ */
+exports.UINT32_BE = {
+ len: 4,
+ get(buf, off) {
+ return buf.readUInt32BE(off);
+ },
+ put(buf, off, v) {
+ return buf.writeUInt32BE(v, off);
+ }
+};
+/**
+ * 8-bit signed integer
+ */
+exports.INT8 = {
+ len: 1,
+ get(buf, off) {
+ return buf.readInt8(off);
+ },
+ put(buf, off, v) {
+ return buf.writeInt8(v, off);
+ }
+};
+/**
+ * 16-bit signed integer, Big Endian byte order
+ */
+exports.INT16_BE = {
+ len: 2,
+ get(buf, off) {
+ return buf.readInt16BE(off);
+ },
+ put(b, o, v) {
+ return b.writeInt16BE(v, o);
+ }
+};
+/**
+ * 16-bit signed integer, Little Endian byte order
+ */
+exports.INT16_LE = {
+ len: 2,
+ get(buf, off) {
+ return buf.readInt16LE(off);
+ },
+ put(b, o, v) {
+ return b.writeInt16LE(v, o);
+ }
+};
+/**
+ * 24-bit signed integer, Little Endian byte order
+ */
+exports.INT24_LE = {
+ len: 3,
+ get(buf, off) {
+ return buf.readIntLE(off, 3);
+ },
+ put(b, o, v) {
+ return b.writeIntLE(v, o, 3);
+ }
+};
+/**
+ * 24-bit signed integer, Big Endian byte order
+ */
+exports.INT24_BE = {
+ len: 3,
+ get(buf, off) {
+ return buf.readIntBE(off, 3);
+ },
+ put(b, o, v) {
+ return b.writeIntBE(v, o, 3);
+ }
+};
+/**
+ * 32-bit signed integer, Big Endian byte order
+ */
+exports.INT32_BE = {
+ len: 4,
+ get(buf, off) {
+ return buf.readInt32BE(off);
+ },
+ put(b, o, v) {
+ return b.writeInt32BE(v, o);
+ }
+};
+/**
+ * 32-bit signed integer, Big Endian byte order
+ */
+exports.INT32_LE = {
+ len: 4,
+ get(buf, off) {
+ return buf.readInt32LE(off);
+ },
+ put(b, o, v) {
+ return b.writeInt32LE(v, o);
+ }
+};
+/**
+ * 64-bit unsigned integer, Little Endian byte order
+ */
+exports.UINT64_LE = {
+ len: 8,
+ get(buf, off) {
+ return readUIntLE(buf, off, this.len);
+ },
+ put(b, o, v) {
+ return writeUIntLE(b, v, o, this.len);
+ }
+};
+/**
+ * 64-bit signed integer, Little Endian byte order
+ */
+exports.INT64_LE = {
+ len: 8,
+ get(buf, off) {
+ return readIntLE(buf, off, this.len);
+ },
+ put(b, off, v) {
+ return writeIntLE(b, v, off, this.len);
+ }
+};
+/**
+ * 64-bit unsigned integer, Big Endian byte order
+ */
+exports.UINT64_BE = {
+ len: 8,
+ get(b, off) {
+ return readUIntBE(b, off, this.len);
+ },
+ put(b, o, v) {
+ return writeUIntBE(b, v, o, this.len);
+ }
+};
+/**
+ * 64-bit signed integer, Big Endian byte order
+ */
+exports.INT64_BE = {
+ len: 8,
+ get(b, off) {
+ return readIntBE(b, off, this.len);
+ },
+ put(b, off, v) {
+ return writeIntBE(b, v, off, this.len);
+ }
+};
+/**
+ * IEEE 754 16-bit (half precision) float, big endian
+ */
+exports.Float16_BE = {
+ len: 2,
+ get(b, off) {
+ return ieee754.read(b, off, false, 10, this.len);
+ },
+ put(b, off, v) {
+ ieee754.write(b, v, off, false, 10, this.len);
+ return off + this.len;
+ }
+};
+/**
+ * IEEE 754 16-bit (half precision) float, little endian
+ */
+exports.Float16_LE = {
+ len: 2,
+ get(b, off) {
+ return ieee754.read(b, off, true, 10, this.len);
+ },
+ put(b, off, v) {
+ ieee754.write(b, v, off, true, 10, this.len);
+ return off + this.len;
+ }
+};
+/**
+ * IEEE 754 32-bit (single precision) float, big endian
+ */
+exports.Float32_BE = {
+ len: 4,
+ get(b, off) {
+ return b.readFloatBE(off);
+ },
+ put(b, off, v) {
+ return b.writeFloatBE(v, off);
+ }
+};
+/**
+ * IEEE 754 32-bit (single precision) float, little endian
+ */
+exports.Float32_LE = {
+ len: 4,
+ get(b, off) {
+ return b.readFloatLE(off);
+ },
+ put(b, off, v) {
+ return b.writeFloatLE(v, off);
+ }
+};
+/**
+ * IEEE 754 64-bit (double precision) float, big endian
+ */
+exports.Float64_BE = {
+ len: 8,
+ get(b, off) {
+ return b.readDoubleBE(off);
+ },
+ put(b, off, v) {
+ return b.writeDoubleBE(v, off);
+ }
+};
+/**
+ * IEEE 754 64-bit (double precision) float, little endian
+ */
+exports.Float64_LE = {
+ len: 8,
+ get(b, off) {
+ return b.readDoubleLE(off);
+ },
+ put(b, off, v) {
+ return b.writeDoubleLE(v, off);
+ }
+};
+/**
+ * IEEE 754 80-bit (extended precision) float, big endian
+ */
+exports.Float80_BE = {
+ len: 10,
+ get(b, off) {
+ return ieee754.read(b, off, false, 63, this.len);
+ },
+ put(b, off, v) {
+ ieee754.write(b, v, off, false, 63, this.len);
+ return off + this.len;
+ }
+};
+/**
+ * IEEE 754 80-bit (extended precision) float, little endian
+ */
+exports.Float80_LE = {
+ len: 10,
+ get(b, off) {
+ return ieee754.read(b, off, true, 63, this.len);
+ },
+ put(b, off, v) {
+ ieee754.write(b, v, off, true, 63, this.len);
+ return off + this.len;
+ }
+};
+/**
+ * Ignore a given number of bytes
+ */
+class IgnoreType {
+ /**
+ * @param len number of bytes to ignore
+ */
+ constructor(len) {
+ this.len = len;
+ }
+ // ToDo: don't read, but skip data
+ get(buf, off) {
+ }
+}
+exports.IgnoreType = IgnoreType;
+class BufferType {
+ constructor(len) {
+ this.len = len;
+ }
+ get(buf, off) {
+ return buf.slice(off, off + this.len);
+ }
+}
+exports.BufferType = BufferType;
+/**
+ * Consume a fixed number of bytes from the stream and return a string with a specified encoding.
+ */
+class StringType {
+ constructor(len, encoding) {
+ this.len = len;
+ this.encoding = encoding;
+ }
+ get(buf, off) {
+ return buf.toString(this.encoding, off, off + this.len);
+ }
+}
+exports.StringType = StringType;
+/**
+ * ANSI Latin 1 String
+ * Using windows-1252 / ISO 8859-1 decoding
+ */
+class AnsiStringType {
+ constructor(len) {
+ this.len = len;
+ }
+ static decode(buffer, off, until) {
+ let str = '';
+ for (let i = off; i < until; ++i) {
+ str += AnsiStringType.codePointToString(AnsiStringType.singleByteDecoder(buffer[i]));
+ }
+ return str;
+ }
+ static inRange(a, min, max) {
+ return min <= a && a <= max;
+ }
+ static codePointToString(cp) {
+ if (cp <= 0xFFFF) {
+ return String.fromCharCode(cp);
+ }
+ else {
+ cp -= 0x10000;
+ return String.fromCharCode((cp >> 10) + 0xD800, (cp & 0x3FF) + 0xDC00);
+ }
+ }
+ static singleByteDecoder(bite) {
+ if (AnsiStringType.inRange(bite, 0x00, 0x7F)) {
+ return bite;
+ }
+ const codePoint = AnsiStringType.windows1252[bite - 0x80];
+ if (codePoint === null) {
+ throw Error('invaliding encoding');
+ }
+ return codePoint;
+ }
+ get(buf, off = 0) {
+ return AnsiStringType.decode(buf, off, off + this.len);
+ }
+}
+exports.AnsiStringType = AnsiStringType;
+AnsiStringType.windows1252 = [8364, 129, 8218, 402, 8222, 8230, 8224, 8225, 710, 8240, 352,
+ 8249, 338, 141, 381, 143, 144, 8216, 8217, 8220, 8221, 8226, 8211, 8212, 732,
+ 8482, 353, 8250, 339, 157, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168,
+ 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184,
+ 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200,
+ 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216,
+ 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
+ 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
+ 248, 249, 250, 251, 252, 253, 254, 255];
+/**
+ * Best effort approach to read up to 64 bit unsigned integer, little endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function readUIntLE(buf, offset, byteLength) {
+ offset = offset >>> 0;
+ byteLength = byteLength >>> 0;
+ let val = buf[offset];
+ let mul = 1;
+ let i = 0;
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += buf[offset + i] * mul;
+ }
+ return val;
+}
+/**
+ * Best effort approach to write up to 64 bit unsigned integer, little endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function writeUIntLE(buf, value, offset, byteLength) {
+ value = +value;
+ offset = offset >>> 0;
+ byteLength = byteLength >>> 0;
+ let mul = 1;
+ let i = 0;
+ buf[offset] = value & 0xFF;
+ while (++i < byteLength && (mul *= 0x100)) {
+ buf[offset + i] = (value / mul) & 0xFF;
+ }
+ return offset + byteLength;
+}
+/**
+ * Best effort approach to read 64 but signed integer, little endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function readIntLE(buf, offset, byteLength) {
+ offset = offset >>> 0;
+ byteLength = byteLength >>> 0;
+ let val = buf[offset];
+ let mul = 1;
+ let i = 0;
+ while (++i < byteLength && (mul *= 0x100)) {
+ val += buf[offset + i] * mul;
+ }
+ mul *= 0x80;
+ if (val >= mul)
+ val -= Math.pow(2, 8 * byteLength);
+ return val;
+}
+/**
+ * Best effort approach to write 64 but signed integer, little endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function writeIntLE(buf, value, offset, byteLength) {
+ value = +value;
+ offset = offset >>> 0;
+ let i = 0;
+ let mul = 1;
+ let sub = 0;
+ buf[offset] = value & 0xFF;
+ while (++i < byteLength && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && buf[offset + i - 1] !== 0) {
+ sub = 1;
+ }
+ buf[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
+ }
+ return offset + byteLength;
+}
+exports.writeIntLE = writeIntLE;
+/**
+ * Best effort approach to read up to 64 bit unsigned integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function readUIntBE(buf, offset, byteLength) {
+ offset = offset >>> 0;
+ byteLength = byteLength >>> 0;
+ let val = buf[offset + --byteLength];
+ let mul = 1;
+ while (byteLength > 0 && (mul *= 0x100)) {
+ val += buf[offset + --byteLength] * mul;
+ }
+ return val;
+}
+exports.readUIntBE = readUIntBE;
+/**
+ * Best effort approach to write up to 64 bit unsigned integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function writeUIntBE(buf, value, offset, byteLength) {
+ value = +value;
+ offset = offset >>> 0;
+ byteLength = byteLength >>> 0;
+ let i = byteLength - 1;
+ let mul = 1;
+ buf[offset + i] = value & 0xFF;
+ while (--i >= 0 && (mul *= 0x100)) {
+ buf[offset + i] = (value / mul) & 0xFF;
+ }
+ return offset + byteLength;
+}
+exports.writeUIntBE = writeUIntBE;
+/**
+ * Best effort approach to read 64 but signed integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function readIntBE(buf, offset, byteLength) {
+ offset = offset >>> 0;
+ byteLength = byteLength >>> 0;
+ let i = byteLength;
+ let mul = 1;
+ let val = buf[offset + --i];
+ while (i > 0 && (mul *= 0x100)) {
+ val += buf[offset + --i] * mul;
+ }
+ mul *= 0x80;
+ if (val >= mul)
+ val -= Math.pow(2, 8 * byteLength);
+ return val;
+}
+exports.readIntBE = readIntBE;
+/**
+ * Best effort approach to write 64 but signed integer, big endian.
+ * Note that JavasScript is limited to 2^53 - 1 bit.
+ */
+function writeIntBE(buf, value, offset, byteLength) {
+ value = +value;
+ offset = offset >>> 0;
+ let i = byteLength - 1;
+ let mul = 1;
+ let sub = 0;
+ buf[offset + i] = value & 0xFF;
+ while (--i >= 0 && (mul *= 0x100)) {
+ if (value < 0 && sub === 0 && buf[offset + i + 1] !== 0) {
+ sub = 1;
+ }
+ buf[offset + i] = ((value / mul) >> 0) - sub & 0xFF;
+ }
+ return offset + byteLength;
+}
+exports.writeIntBE = writeIntBE;
diff --git a/node_modules/token-types/node_modules/ieee754/LICENSE b/node_modules/token-types/node_modules/ieee754/LICENSE
new file mode 100644
index 0000000..5aac82c
--- /dev/null
+++ b/node_modules/token-types/node_modules/ieee754/LICENSE
@@ -0,0 +1,11 @@
+Copyright 2008 Fair Oaks Labs, Inc.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/node_modules/token-types/node_modules/ieee754/README.md b/node_modules/token-types/node_modules/ieee754/README.md
new file mode 100644
index 0000000..cb7527b
--- /dev/null
+++ b/node_modules/token-types/node_modules/ieee754/README.md
@@ -0,0 +1,51 @@
+# ieee754 [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
+
+[travis-image]: https://img.shields.io/travis/feross/ieee754/master.svg
+[travis-url]: https://travis-ci.org/feross/ieee754
+[npm-image]: https://img.shields.io/npm/v/ieee754.svg
+[npm-url]: https://npmjs.org/package/ieee754
+[downloads-image]: https://img.shields.io/npm/dm/ieee754.svg
+[downloads-url]: https://npmjs.org/package/ieee754
+[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
+[standard-url]: https://standardjs.com
+
+[![saucelabs][saucelabs-image]][saucelabs-url]
+
+[saucelabs-image]: https://saucelabs.com/browser-matrix/ieee754.svg
+[saucelabs-url]: https://saucelabs.com/u/ieee754
+
+### Read/write IEEE754 floating point numbers from/to a Buffer or array-like object.
+
+## install
+
+```
+npm install ieee754
+```
+
+## methods
+
+`var ieee754 = require('ieee754')`
+
+The `ieee754` object has the following functions:
+
+```
+ieee754.read = function (buffer, offset, isLE, mLen, nBytes)
+ieee754.write = function (buffer, value, offset, isLE, mLen, nBytes)
+```
+
+The arguments mean the following:
+
+- buffer = the buffer
+- offset = offset into the buffer
+- value = value to set (only for `write`)
+- isLe = is little endian?
+- mLen = mantissa length
+- nBytes = number of bytes
+
+## what is ieee754?
+
+The IEEE Standard for Floating-Point Arithmetic (IEEE 754) is a technical standard for floating-point computation. [Read more](http://en.wikipedia.org/wiki/IEEE_floating_point).
+
+## license
+
+BSD 3 Clause. Copyright (c) 2008, Fair Oaks Labs, Inc.
diff --git a/node_modules/token-types/node_modules/ieee754/index.d.ts b/node_modules/token-types/node_modules/ieee754/index.d.ts
new file mode 100644
index 0000000..f1e4354
--- /dev/null
+++ b/node_modules/token-types/node_modules/ieee754/index.d.ts
@@ -0,0 +1,10 @@
+declare namespace ieee754 {
+ export function read(
+ buffer: Uint8Array, offset: number, isLE: boolean, mLen: number,
+ nBytes: number): number;
+ export function write(
+ buffer: Uint8Array, value: number, offset: number, isLE: boolean,
+ mLen: number, nBytes: number): void;
+ }
+
+ export = ieee754; \ No newline at end of file
diff --git a/node_modules/token-types/node_modules/ieee754/index.js b/node_modules/token-types/node_modules/ieee754/index.js
new file mode 100644
index 0000000..81d26c3
--- /dev/null
+++ b/node_modules/token-types/node_modules/ieee754/index.js
@@ -0,0 +1,85 @@
+/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
+exports.read = function (buffer, offset, isLE, mLen, nBytes) {
+ var e, m
+ var eLen = (nBytes * 8) - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var nBits = -7
+ var i = isLE ? (nBytes - 1) : 0
+ var d = isLE ? -1 : 1
+ var s = buffer[offset + i]
+
+ i += d
+
+ e = s & ((1 << (-nBits)) - 1)
+ s >>= (-nBits)
+ nBits += eLen
+ for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
+
+ m = e & ((1 << (-nBits)) - 1)
+ e >>= (-nBits)
+ nBits += mLen
+ for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
+
+ if (e === 0) {
+ e = 1 - eBias
+ } else if (e === eMax) {
+ return m ? NaN : ((s ? -1 : 1) * Infinity)
+ } else {
+ m = m + Math.pow(2, mLen)
+ e = e - eBias
+ }
+ return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
+}
+
+exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
+ var e, m, c
+ var eLen = (nBytes * 8) - mLen - 1
+ var eMax = (1 << eLen) - 1
+ var eBias = eMax >> 1
+ var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
+ var i = isLE ? 0 : (nBytes - 1)
+ var d = isLE ? 1 : -1
+ var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
+
+ value = Math.abs(value)
+
+ if (isNaN(value) || value === Infinity) {
+ m = isNaN(value) ? 1 : 0
+ e = eMax
+ } else {
+ e = Math.floor(Math.log(value) / Math.LN2)
+ if (value * (c = Math.pow(2, -e)) < 1) {
+ e--
+ c *= 2
+ }
+ if (e + eBias >= 1) {
+ value += rt / c
+ } else {
+ value += rt * Math.pow(2, 1 - eBias)
+ }
+ if (value * c >= 2) {
+ e++
+ c /= 2
+ }
+
+ if (e + eBias >= eMax) {
+ m = 0
+ e = eMax
+ } else if (e + eBias >= 1) {
+ m = ((value * c) - 1) * Math.pow(2, mLen)
+ e = e + eBias
+ } else {
+ m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
+ e = 0
+ }
+ }
+
+ for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
+
+ e = (e << mLen) | m
+ eLen += mLen
+ for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
+
+ buffer[offset + i - d] |= s * 128
+}
diff --git a/node_modules/token-types/node_modules/ieee754/package.json b/node_modules/token-types/node_modules/ieee754/package.json
new file mode 100644
index 0000000..7564124
--- /dev/null
+++ b/node_modules/token-types/node_modules/ieee754/package.json
@@ -0,0 +1,84 @@
+{
+ "_from": "ieee754@^1.2.1",
+ "_id": "ieee754@1.2.1",
+ "_inBundle": false,
+ "_integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==",
+ "_location": "/token-types/ieee754",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "ieee754@^1.2.1",
+ "name": "ieee754",
+ "escapedName": "ieee754",
+ "rawSpec": "^1.2.1",
+ "saveSpec": null,
+ "fetchSpec": "^1.2.1"
+ },
+ "_requiredBy": [
+ "/token-types"
+ ],
+ "_resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz",
+ "_shasum": "8eb7a10a63fff25d15a57b001586d177d1b0d352",
+ "_spec": "ieee754@^1.2.1",
+ "_where": "/data/dev/Projets/FNS Electrode/Projets/FNS Electrode/node_modules/token-types",
+ "author": {
+ "name": "Feross Aboukhadijeh",
+ "email": "feross@feross.org",
+ "url": "https://feross.org"
+ },
+ "bugs": {
+ "url": "https://github.com/feross/ieee754/issues"
+ },
+ "bundleDependencies": false,
+ "contributors": [
+ {
+ "name": "Romain Beauxis",
+ "email": "toots@rastageeks.org"
+ }
+ ],
+ "deprecated": false,
+ "description": "Read/write IEEE754 floating point numbers from/to a Buffer or array-like object",
+ "devDependencies": {
+ "airtap": "^3.0.0",
+ "standard": "*",
+ "tape": "^5.0.1"
+ },
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "homepage": "https://github.com/feross/ieee754#readme",
+ "keywords": [
+ "IEEE 754",
+ "buffer",
+ "convert",
+ "floating point",
+ "ieee754"
+ ],
+ "license": "BSD-3-Clause",
+ "main": "index.js",
+ "name": "ieee754",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/feross/ieee754.git"
+ },
+ "scripts": {
+ "test": "standard && npm run test-node && npm run test-browser",
+ "test-browser": "airtap -- test/*.js",
+ "test-browser-local": "airtap --local -- test/*.js",
+ "test-node": "tape test/*.js"
+ },
+ "types": "index.d.ts",
+ "version": "1.2.1"
+}
diff --git a/node_modules/token-types/package.json b/node_modules/token-types/package.json
new file mode 100644
index 0000000..f069761
--- /dev/null
+++ b/node_modules/token-types/package.json
@@ -0,0 +1,120 @@
+{
+ "_from": "token-types@^2.0.0",
+ "_id": "token-types@2.1.1",
+ "_inBundle": false,
+ "_integrity": "sha512-wnQcqlreS6VjthyHO3Y/kpK/emflxDBNhlNUPfh7wE39KnuDdOituXomIbyI79vBtF0Ninpkh72mcuRHo+RG3Q==",
+ "_location": "/token-types",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "range",
+ "registry": true,
+ "raw": "token-types@^2.0.0",
+ "name": "token-types",
+ "escapedName": "token-types",
+ "rawSpec": "^2.0.0",
+ "saveSpec": null,
+ "fetchSpec": "^2.0.0"
+ },
+ "_requiredBy": [
+ "/file-type"
+ ],
+ "_resolved": "https://registry.npmjs.org/token-types/-/token-types-2.1.1.tgz",
+ "_shasum": "bd585d64902aaf720b8979d257b4b850b4d45c45",
+ "_spec": "token-types@^2.0.0",
+ "_where": "/data/dev/Projets/FNS Electrode/Projets/FNS Electrode/node_modules/file-type",
+ "author": {
+ "name": "Borewit",
+ "url": "https://github.com/Borewit"
+ },
+ "bugs": {
+ "url": "https://github.com/Borewit/token-types/issues"
+ },
+ "bundleDependencies": false,
+ "dependencies": {
+ "@tokenizer/token": "^0.1.1",
+ "ieee754": "^1.2.1"
+ },
+ "deprecated": false,
+ "description": "Common token types for decoding and encoding numeric and string values",
+ "devDependencies": {
+ "@types/chai": "^4.2.14",
+ "@types/mocha": "^8.2.0",
+ "@types/node": "^14.14.20",
+ "chai": "^4.2.0",
+ "coveralls": "^3.1.0",
+ "del-cli": "^3.0.1",
+ "mocha": "^7.2.0",
+ "nyc": "^15.1.0",
+ "remark-cli": "^9.0.0",
+ "remark-preset-lint-recommended": "^5.0.0",
+ "source-map-support": "^0.5.19",
+ "ts-node": "^9.1.1",
+ "tslint": "^6.1.3",
+ "typescript": "^4.1.3"
+ },
+ "engines": {
+ "node": ">=0.1.98"
+ },
+ "files": [
+ "lib/index.js",
+ "lib/index.d.ts"
+ ],
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/Borewit"
+ },
+ "homepage": "https://github.com/Borewit/token-types#readme",
+ "keywords": [
+ "token",
+ "integer",
+ "unsigned",
+ "numeric",
+ "float",
+ "IEEE",
+ "754",
+ "strtok3"
+ ],
+ "license": "MIT",
+ "main": "lib/index.js",
+ "name": "token-types",
+ "nyc": {
+ "exclude": [
+ "test/**/*.ts",
+ "lib/**/*.*.js"
+ ],
+ "extension": [
+ ".ts"
+ ],
+ "sourceMap": true,
+ "instrument": true,
+ "reporter": [
+ "lcov",
+ "text"
+ ],
+ "report-dir": "coverage"
+ },
+ "remarkConfig": {
+ "plugins": [
+ "preset-lint-recommended"
+ ]
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/Borewit/token-types.git"
+ },
+ "scripts": {
+ "build": "npm run compile",
+ "clean": "del-cli lib/**/*.js lib/***.js.map *.d.ts test/**/*.d.ts test/**/*.js test/**/*.js.map .nyc_output",
+ "compile": "npm run compile-src && npm run compile-test",
+ "compile-src": "tsc --p lib",
+ "compile-test": "tsc --p test",
+ "coveralls": "npm run test-coverage && nyc report --reporter=text-lcov | coveralls",
+ "lint": "npm run lint-ts && npm run lint-md",
+ "lint-md": "remark -u preset-lint-recommended .",
+ "lint-ts": "tslint index.ts --exclude '*.d.ts' 'test/**/*.ts' --exclude 'test/**/*.d.ts'",
+ "test": "mocha --require ts-node/register --require source-map-support/register --full-trace --recursive test/test-*.ts",
+ "test-coverage": "nyc npm run test"
+ },
+ "types": "lib/index.d.ts",
+ "version": "2.1.1"
+}