@jsonjoy.com/json-pack 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +432 -0
- package/lib/JsonPackExtension.d.ts +5 -0
- package/lib/JsonPackExtension.js +11 -0
- package/lib/JsonPackExtension.js.map +1 -0
- package/lib/JsonPackValue.d.ts +4 -0
- package/lib/JsonPackValue.js +10 -0
- package/lib/JsonPackValue.js.map +1 -0
- package/lib/__demos__/cbor.d.ts +1 -0
- package/lib/__demos__/cbor.js +50 -0
- package/lib/__demos__/cbor.js.map +1 -0
- package/lib/__demos__/json.d.ts +1 -0
- package/lib/__demos__/json.js +27 -0
- package/lib/__demos__/json.js.map +1 -0
- package/lib/__demos__/msgpack.d.ts +1 -0
- package/lib/__demos__/msgpack.js +35 -0
- package/lib/__demos__/msgpack.js.map +1 -0
- package/lib/__demos__/ubjson.d.ts +1 -0
- package/lib/__demos__/ubjson.js +27 -0
- package/lib/__demos__/ubjson.js.map +1 -0
- package/lib/bencode/BencodeDecoder.d.ts +18 -0
- package/lib/bencode/BencodeDecoder.js +156 -0
- package/lib/bencode/BencodeDecoder.js.map +1 -0
- package/lib/bencode/BencodeEncoder.d.ts +24 -0
- package/lib/bencode/BencodeEncoder.js +147 -0
- package/lib/bencode/BencodeEncoder.js.map +1 -0
- package/lib/bencode/index.d.ts +3 -0
- package/lib/bencode/index.js +7 -0
- package/lib/bencode/index.js.map +1 -0
- package/lib/bencode/types.d.ts +4 -0
- package/lib/bencode/types.js +3 -0
- package/lib/bencode/types.js.map +1 -0
- package/lib/bson/BsonEncoder.d.ts +27 -0
- package/lib/bson/BsonEncoder.js +364 -0
- package/lib/bson/BsonEncoder.js.map +1 -0
- package/lib/bson/index.d.ts +2 -0
- package/lib/bson/index.js +6 -0
- package/lib/bson/index.js.map +1 -0
- package/lib/bson/values.d.ts +54 -0
- package/lib/bson/values.js +82 -0
- package/lib/bson/values.js.map +1 -0
- package/lib/cbor/CborDecoder.d.ts +41 -0
- package/lib/cbor/CborDecoder.js +356 -0
- package/lib/cbor/CborDecoder.js.map +1 -0
- package/lib/cbor/CborDecoderBase.d.ts +34 -0
- package/lib/cbor/CborDecoderBase.js +340 -0
- package/lib/cbor/CborDecoderBase.js.map +1 -0
- package/lib/cbor/CborDecoderDag.d.ts +5 -0
- package/lib/cbor/CborDecoderDag.js +13 -0
- package/lib/cbor/CborDecoderDag.js.map +1 -0
- package/lib/cbor/CborEncoder.d.ts +9 -0
- package/lib/cbor/CborEncoder.js +68 -0
- package/lib/cbor/CborEncoder.js.map +1 -0
- package/lib/cbor/CborEncoderDag.d.ts +6 -0
- package/lib/cbor/CborEncoderDag.js +23 -0
- package/lib/cbor/CborEncoderDag.js.map +1 -0
- package/lib/cbor/CborEncoderFast.d.ts +51 -0
- package/lib/cbor/CborEncoderFast.js +333 -0
- package/lib/cbor/CborEncoderFast.js.map +1 -0
- package/lib/cbor/CborEncoderStable.d.ts +6 -0
- package/lib/cbor/CborEncoderStable.js +71 -0
- package/lib/cbor/CborEncoderStable.js.map +1 -0
- package/lib/cbor/constants.d.ts +39 -0
- package/lib/cbor/constants.js +3 -0
- package/lib/cbor/constants.js.map +1 -0
- package/lib/cbor/index.d.ts +8 -0
- package/lib/cbor/index.js +12 -0
- package/lib/cbor/index.js.map +1 -0
- package/lib/cbor/shared.d.ts +8 -0
- package/lib/cbor/shared.js +12 -0
- package/lib/cbor/shared.js.map +1 -0
- package/lib/cbor/types.d.ts +4 -0
- package/lib/cbor/types.js +3 -0
- package/lib/cbor/types.js.map +1 -0
- package/lib/codecs/Codecs.d.ts +11 -0
- package/lib/codecs/Codecs.js +16 -0
- package/lib/codecs/Codecs.js.map +1 -0
- package/lib/codecs/cbor.d.ts +12 -0
- package/lib/codecs/cbor.js +15 -0
- package/lib/codecs/cbor.js.map +1 -0
- package/lib/codecs/json.d.ts +12 -0
- package/lib/codecs/json.js +15 -0
- package/lib/codecs/json.js.map +1 -0
- package/lib/codecs/msgpack.d.ts +12 -0
- package/lib/codecs/msgpack.js +15 -0
- package/lib/codecs/msgpack.js.map +1 -0
- package/lib/codecs/types.d.ts +8 -0
- package/lib/codecs/types.js +3 -0
- package/lib/codecs/types.js.map +1 -0
- package/lib/constants.d.ts +5 -0
- package/lib/constants.js +3 -0
- package/lib/constants.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/index.js.map +1 -0
- package/lib/ion/Import.d.ts +14 -0
- package/lib/ion/Import.js +48 -0
- package/lib/ion/Import.js.map +1 -0
- package/lib/ion/IonEncoderFast.d.ts +22 -0
- package/lib/ion/IonEncoderFast.js +247 -0
- package/lib/ion/IonEncoderFast.js.map +1 -0
- package/lib/ion/ast.d.ts +68 -0
- package/lib/ion/ast.js +213 -0
- package/lib/ion/ast.js.map +1 -0
- package/lib/ion/constants.d.ts +24 -0
- package/lib/ion/constants.js +3 -0
- package/lib/ion/constants.js.map +1 -0
- package/lib/ion/index.d.ts +5 -0
- package/lib/ion/index.js +9 -0
- package/lib/ion/index.js.map +1 -0
- package/lib/ion/symbols.d.ts +4 -0
- package/lib/ion/symbols.js +17 -0
- package/lib/ion/symbols.js.map +1 -0
- package/lib/ion/types.d.ts +1 -0
- package/lib/ion/types.js +3 -0
- package/lib/ion/types.js.map +1 -0
- package/lib/json/JsonDecoder.d.ts +19 -0
- package/lib/json/JsonDecoder.js +594 -0
- package/lib/json/JsonDecoder.js.map +1 -0
- package/lib/json/JsonDecoderDag.d.ts +9 -0
- package/lib/json/JsonDecoderDag.js +118 -0
- package/lib/json/JsonDecoderDag.js.map +1 -0
- package/lib/json/JsonEncoder.d.ts +36 -0
- package/lib/json/JsonEncoder.js +253 -0
- package/lib/json/JsonEncoder.js.map +1 -0
- package/lib/json/JsonEncoderDag.d.ts +5 -0
- package/lib/json/JsonEncoderDag.js +44 -0
- package/lib/json/JsonEncoderDag.js.map +1 -0
- package/lib/json/JsonEncoderStable.d.ts +4 -0
- package/lib/json/JsonEncoderStable.js +28 -0
- package/lib/json/JsonEncoderStable.js.map +1 -0
- package/lib/json/index.d.ts +6 -0
- package/lib/json/index.js +10 -0
- package/lib/json/index.js.map +1 -0
- package/lib/json/types.d.ts +4 -0
- package/lib/json/types.js +3 -0
- package/lib/json/types.js.map +1 -0
- package/lib/json/util.d.ts +1 -0
- package/lib/json/util.js +22 -0
- package/lib/json/util.js.map +1 -0
- package/lib/json-binary/codec.d.ts +8 -0
- package/lib/json-binary/codec.js +128 -0
- package/lib/json-binary/codec.js.map +1 -0
- package/lib/json-binary/constants.d.ts +3 -0
- package/lib/json-binary/constants.js +8 -0
- package/lib/json-binary/constants.js.map +1 -0
- package/lib/json-binary/index.d.ts +3 -0
- package/lib/json-binary/index.js +7 -0
- package/lib/json-binary/index.js.map +1 -0
- package/lib/json-binary/types.d.ts +7 -0
- package/lib/json-binary/types.js +3 -0
- package/lib/json-binary/types.js.map +1 -0
- package/lib/json-brand/index.d.ts +3 -0
- package/lib/json-brand/index.js +5 -0
- package/lib/json-brand/index.js.map +1 -0
- package/lib/json-brand/types.d.ts +10 -0
- package/lib/json-brand/types.js +3 -0
- package/lib/json-brand/types.js.map +1 -0
- package/lib/json-equal/$$deepEqual/index.d.ts +1 -0
- package/lib/json-equal/$$deepEqual/index.js +5 -0
- package/lib/json-equal/$$deepEqual/index.js.map +1 -0
- package/lib/json-equal/$$deepEqual/v1.d.ts +2 -0
- package/lib/json-equal/$$deepEqual/v1.js +52 -0
- package/lib/json-equal/$$deepEqual/v1.js.map +1 -0
- package/lib/json-equal/deepEqual/index.d.ts +1 -0
- package/lib/json-equal/deepEqual/index.js +5 -0
- package/lib/json-equal/deepEqual/index.js.map +1 -0
- package/lib/json-equal/deepEqual/v1.d.ts +1 -0
- package/lib/json-equal/deepEqual/v1.js +34 -0
- package/lib/json-equal/deepEqual/v1.js.map +1 -0
- package/lib/json-equal/deepEqual/v2.d.ts +1 -0
- package/lib/json-equal/deepEqual/v2.js +37 -0
- package/lib/json-equal/deepEqual/v2.js.map +1 -0
- package/lib/json-equal/deepEqual/v3.d.ts +1 -0
- package/lib/json-equal/deepEqual/v3.js +37 -0
- package/lib/json-equal/deepEqual/v3.js.map +1 -0
- package/lib/json-equal/deepEqual/v4.d.ts +1 -0
- package/lib/json-equal/deepEqual/v4.js +34 -0
- package/lib/json-equal/deepEqual/v4.js.map +1 -0
- package/lib/json-pointer/index.d.ts +1 -0
- package/lib/json-pointer/index.js +5 -0
- package/lib/json-pointer/index.js.map +1 -0
- package/lib/json-pointer/types.d.ts +2 -0
- package/lib/json-pointer/types.js +3 -0
- package/lib/json-pointer/types.js.map +1 -0
- package/lib/json-random/RandomJson.d.ts +39 -0
- package/lib/json-random/RandomJson.js +267 -0
- package/lib/json-random/RandomJson.js.map +1 -0
- package/lib/json-random/__demos__/json-random.d.ts +1 -0
- package/lib/json-random/__demos__/json-random.js +35 -0
- package/lib/json-random/__demos__/json-random.js.map +1 -0
- package/lib/json-random/index.d.ts +1 -0
- package/lib/json-random/index.js +5 -0
- package/lib/json-random/index.js.map +1 -0
- package/lib/msgpack/MsgPackDecoder.d.ts +19 -0
- package/lib/msgpack/MsgPackDecoder.js +233 -0
- package/lib/msgpack/MsgPackDecoder.js.map +1 -0
- package/lib/msgpack/MsgPackDecoderFast.d.ts +18 -0
- package/lib/msgpack/MsgPackDecoderFast.js +182 -0
- package/lib/msgpack/MsgPackDecoderFast.js.map +1 -0
- package/lib/msgpack/MsgPackEncoder.d.ts +5 -0
- package/lib/msgpack/MsgPackEncoder.js +40 -0
- package/lib/msgpack/MsgPackEncoder.js.map +1 -0
- package/lib/msgpack/MsgPackEncoderFast.d.ts +45 -0
- package/lib/msgpack/MsgPackEncoderFast.js +296 -0
- package/lib/msgpack/MsgPackEncoderFast.js.map +1 -0
- package/lib/msgpack/MsgPackEncoderStable.d.ts +4 -0
- package/lib/msgpack/MsgPackEncoderStable.js +19 -0
- package/lib/msgpack/MsgPackEncoderStable.js.map +1 -0
- package/lib/msgpack/MsgPackToJsonConverter.d.ts +24 -0
- package/lib/msgpack/MsgPackToJsonConverter.js +218 -0
- package/lib/msgpack/MsgPackToJsonConverter.js.map +1 -0
- package/lib/msgpack/constants.d.ts +6 -0
- package/lib/msgpack/constants.js +3 -0
- package/lib/msgpack/constants.js.map +1 -0
- package/lib/msgpack/index.d.ts +8 -0
- package/lib/msgpack/index.js +20 -0
- package/lib/msgpack/index.js.map +1 -0
- package/lib/msgpack/shallow-read.d.ts +6 -0
- package/lib/msgpack/shallow-read.js +102 -0
- package/lib/msgpack/shallow-read.js.map +1 -0
- package/lib/msgpack/types.d.ts +15 -0
- package/lib/msgpack/types.js +3 -0
- package/lib/msgpack/types.js.map +1 -0
- package/lib/msgpack/util.d.ts +11 -0
- package/lib/msgpack/util.js +16 -0
- package/lib/msgpack/util.js.map +1 -0
- package/lib/resp/RespDecoder.d.ts +39 -0
- package/lib/resp/RespDecoder.js +388 -0
- package/lib/resp/RespDecoder.js.map +1 -0
- package/lib/resp/RespEncoder.d.ts +60 -0
- package/lib/resp/RespEncoder.js +424 -0
- package/lib/resp/RespEncoder.js.map +1 -0
- package/lib/resp/RespEncoderLegacy.d.ts +12 -0
- package/lib/resp/RespEncoderLegacy.js +105 -0
- package/lib/resp/RespEncoderLegacy.js.map +1 -0
- package/lib/resp/RespStreamingDecoder.d.ts +12 -0
- package/lib/resp/RespStreamingDecoder.js +79 -0
- package/lib/resp/RespStreamingDecoder.js.map +1 -0
- package/lib/resp/constants.d.ts +22 -0
- package/lib/resp/constants.js +3 -0
- package/lib/resp/constants.js.map +1 -0
- package/lib/resp/extensions.d.ts +13 -0
- package/lib/resp/extensions.js +26 -0
- package/lib/resp/extensions.js.map +1 -0
- package/lib/resp/index.d.ts +6 -0
- package/lib/resp/index.js +10 -0
- package/lib/resp/index.js.map +1 -0
- package/lib/types.d.ts +61 -0
- package/lib/types.js +3 -0
- package/lib/types.js.map +1 -0
- package/lib/ubjson/UbjsonDecoder.d.ts +8 -0
- package/lib/ubjson/UbjsonDecoder.js +128 -0
- package/lib/ubjson/UbjsonDecoder.js.map +1 -0
- package/lib/ubjson/UbjsonEncoder.d.ts +34 -0
- package/lib/ubjson/UbjsonEncoder.js +218 -0
- package/lib/ubjson/UbjsonEncoder.js.map +1 -0
- package/lib/ubjson/index.d.ts +2 -0
- package/lib/ubjson/index.js +6 -0
- package/lib/ubjson/index.js.map +1 -0
- package/lib/util/CompressionTable.d.ts +14 -0
- package/lib/util/CompressionTable.js +169 -0
- package/lib/util/CompressionTable.js.map +1 -0
- package/lib/util/DecompressionTable.d.ts +6 -0
- package/lib/util/DecompressionTable.js +96 -0
- package/lib/util/DecompressionTable.js.map +1 -0
- package/lib/util/Fuzzer.d.ts +13 -0
- package/lib/util/Fuzzer.js +59 -0
- package/lib/util/Fuzzer.js.map +1 -0
- package/lib/util/NullObject.d.ts +1 -0
- package/lib/util/NullObject.js +6 -0
- package/lib/util/NullObject.js.map +1 -0
- package/lib/util/base64/constants.d.ts +2 -0
- package/lib/util/base64/constants.js +6 -0
- package/lib/util/base64/constants.js.map +1 -0
- package/lib/util/base64/createFromBase64.d.ts +1 -0
- package/lib/util/base64/createFromBase64.js +80 -0
- package/lib/util/base64/createFromBase64.js.map +1 -0
- package/lib/util/base64/createFromBase64Bin.d.ts +1 -0
- package/lib/util/base64/createFromBase64Bin.js +87 -0
- package/lib/util/base64/createFromBase64Bin.js.map +1 -0
- package/lib/util/base64/createToBase64.d.ts +1 -0
- package/lib/util/base64/createToBase64.js +48 -0
- package/lib/util/base64/createToBase64.js.map +1 -0
- package/lib/util/base64/createToBase64Bin.d.ts +1 -0
- package/lib/util/base64/createToBase64Bin.js +62 -0
- package/lib/util/base64/createToBase64Bin.js.map +1 -0
- package/lib/util/base64/createToBase64BinUint8.d.ts +1 -0
- package/lib/util/base64/createToBase64BinUint8.js +59 -0
- package/lib/util/base64/createToBase64BinUint8.js.map +1 -0
- package/lib/util/base64/fromBase64.d.ts +1 -0
- package/lib/util/base64/fromBase64.js +12 -0
- package/lib/util/base64/fromBase64.js.map +1 -0
- package/lib/util/base64/fromBase64Bin.d.ts +1 -0
- package/lib/util/base64/fromBase64Bin.js +6 -0
- package/lib/util/base64/fromBase64Bin.js.map +1 -0
- package/lib/util/base64/fromBase64Url.d.ts +1 -0
- package/lib/util/base64/fromBase64Url.js +6 -0
- package/lib/util/base64/fromBase64Url.js.map +1 -0
- package/lib/util/base64/index.d.ts +7 -0
- package/lib/util/base64/index.js +11 -0
- package/lib/util/base64/index.js.map +1 -0
- package/lib/util/base64/toBase64.d.ts +1 -0
- package/lib/util/base64/toBase64.js +15 -0
- package/lib/util/base64/toBase64.js.map +1 -0
- package/lib/util/base64/toBase64Bin.d.ts +1 -0
- package/lib/util/base64/toBase64Bin.js +6 -0
- package/lib/util/base64/toBase64Bin.js.map +1 -0
- package/lib/util/base64/toBase64Url.d.ts +1 -0
- package/lib/util/base64/toBase64Url.js +6 -0
- package/lib/util/base64/toBase64Url.js.map +1 -0
- package/lib/util/buffers/Reader.d.ts +22 -0
- package/lib/util/buffers/Reader.js +91 -0
- package/lib/util/buffers/Reader.js.map +1 -0
- package/lib/util/buffers/Slice.d.ts +8 -0
- package/lib/util/buffers/Slice.js +16 -0
- package/lib/util/buffers/Slice.js.map +1 -0
- package/lib/util/buffers/StreamingOctetReader.d.ts +18 -0
- package/lib/util/buffers/StreamingOctetReader.js +168 -0
- package/lib/util/buffers/StreamingOctetReader.js.map +1 -0
- package/lib/util/buffers/StreamingReader.d.ts +31 -0
- package/lib/util/buffers/StreamingReader.js +131 -0
- package/lib/util/buffers/StreamingReader.js.map +1 -0
- package/lib/util/buffers/Uint8ArrayCut.d.ts +6 -0
- package/lib/util/buffers/Uint8ArrayCut.js +12 -0
- package/lib/util/buffers/Uint8ArrayCut.js.map +1 -0
- package/lib/util/buffers/Writer.d.ts +33 -0
- package/lib/util/buffers/Writer.js +217 -0
- package/lib/util/buffers/Writer.js.map +1 -0
- package/lib/util/buffers/b.d.ts +1 -0
- package/lib/util/buffers/b.js +6 -0
- package/lib/util/buffers/b.js.map +1 -0
- package/lib/util/buffers/bufferToUint8Array.d.ts +2 -0
- package/lib/util/buffers/bufferToUint8Array.js +6 -0
- package/lib/util/buffers/bufferToUint8Array.js.map +1 -0
- package/lib/util/buffers/cmpUint8Array.d.ts +1 -0
- package/lib/util/buffers/cmpUint8Array.js +14 -0
- package/lib/util/buffers/cmpUint8Array.js.map +1 -0
- package/lib/util/buffers/cmpUint8Array2.d.ts +1 -0
- package/lib/util/buffers/cmpUint8Array2.js +16 -0
- package/lib/util/buffers/cmpUint8Array2.js.map +1 -0
- package/lib/util/buffers/cmpUint8Array3.d.ts +1 -0
- package/lib/util/buffers/cmpUint8Array3.js +18 -0
- package/lib/util/buffers/cmpUint8Array3.js.map +1 -0
- package/lib/util/buffers/concat.d.ts +3 -0
- package/lib/util/buffers/concat.js +36 -0
- package/lib/util/buffers/concat.js.map +1 -0
- package/lib/util/buffers/copy.d.ts +1 -0
- package/lib/util/buffers/copy.js +10 -0
- package/lib/util/buffers/copy.js.map +1 -0
- package/lib/util/buffers/f16.d.ts +1 -0
- package/lib/util/buffers/f16.js +18 -0
- package/lib/util/buffers/f16.js.map +1 -0
- package/lib/util/buffers/index.d.ts +1 -0
- package/lib/util/buffers/index.js +5 -0
- package/lib/util/buffers/index.js.map +1 -0
- package/lib/util/buffers/isArrayBuffer.d.ts +1 -0
- package/lib/util/buffers/isArrayBuffer.js +8 -0
- package/lib/util/buffers/isArrayBuffer.js.map +1 -0
- package/lib/util/buffers/isFloat32.d.ts +1 -0
- package/lib/util/buffers/isFloat32.js +10 -0
- package/lib/util/buffers/isFloat32.js.map +1 -0
- package/lib/util/buffers/isUint8Array.d.ts +1 -0
- package/lib/util/buffers/isUint8Array.js +7 -0
- package/lib/util/buffers/isUint8Array.js.map +1 -0
- package/lib/util/buffers/printOctets.d.ts +1 -0
- package/lib/util/buffers/printOctets.js +23 -0
- package/lib/util/buffers/printOctets.js.map +1 -0
- package/lib/util/buffers/strings.d.ts +6 -0
- package/lib/util/buffers/strings.js +23 -0
- package/lib/util/buffers/strings.js.map +1 -0
- package/lib/util/buffers/toBuf.d.ts +1 -0
- package/lib/util/buffers/toBuf.js +12 -0
- package/lib/util/buffers/toBuf.js.map +1 -0
- package/lib/util/buffers/toDataUri.d.ts +1 -0
- package/lib/util/buffers/toDataUri.js +12 -0
- package/lib/util/buffers/toDataUri.js.map +1 -0
- package/lib/util/buffers/toUint8Array.d.ts +1 -0
- package/lib/util/buffers/toUint8Array.js +19 -0
- package/lib/util/buffers/toUint8Array.js.map +1 -0
- package/lib/util/buffers/types.d.ts +54 -0
- package/lib/util/buffers/types.js +3 -0
- package/lib/util/buffers/types.js.map +1 -0
- package/lib/util/buffers/utf8/CachedUtf8Decoder.d.ts +7 -0
- package/lib/util/buffers/utf8/CachedUtf8Decoder.js +54 -0
- package/lib/util/buffers/utf8/CachedUtf8Decoder.js.map +1 -0
- package/lib/util/buffers/utf8/decodeAscii.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeAscii.js +163 -0
- package/lib/util/buffers/utf8/decodeAscii.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/index.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/index.js +7 -0
- package/lib/util/buffers/utf8/decodeUtf8/index.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v1.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v1.js +46 -0
- package/lib/util/buffers/utf8/decodeUtf8/v1.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v10.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v10.js +43 -0
- package/lib/util/buffers/utf8/decodeUtf8/v10.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v11.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v11.js +5 -0
- package/lib/util/buffers/utf8/decodeUtf8/v11.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v12.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v12.js +7 -0
- package/lib/util/buffers/utf8/decodeUtf8/v12.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v13.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v13.js +26 -0
- package/lib/util/buffers/utf8/decodeUtf8/v13.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v14.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v14.js +10 -0
- package/lib/util/buffers/utf8/decodeUtf8/v14.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v15.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v15.js +18 -0
- package/lib/util/buffers/utf8/decodeUtf8/v15.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v16.d.ts +3 -0
- package/lib/util/buffers/utf8/decodeUtf8/v16.js +26 -0
- package/lib/util/buffers/utf8/decodeUtf8/v16.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v17.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v17.js +42 -0
- package/lib/util/buffers/utf8/decodeUtf8/v17.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v18.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v18.js +41 -0
- package/lib/util/buffers/utf8/decodeUtf8/v18.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v19.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v19.js +5 -0
- package/lib/util/buffers/utf8/decodeUtf8/v19.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v2.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v2.js +4 -0
- package/lib/util/buffers/utf8/decodeUtf8/v2.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v3.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v3.js +6 -0
- package/lib/util/buffers/utf8/decodeUtf8/v3.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v4.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v4.js +6 -0
- package/lib/util/buffers/utf8/decodeUtf8/v4.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v5.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v5.js +37 -0
- package/lib/util/buffers/utf8/decodeUtf8/v5.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v6.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v6.js +8 -0
- package/lib/util/buffers/utf8/decodeUtf8/v6.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v7.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v7.js +39 -0
- package/lib/util/buffers/utf8/decodeUtf8/v7.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v8.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v8.js +46 -0
- package/lib/util/buffers/utf8/decodeUtf8/v8.js.map +1 -0
- package/lib/util/buffers/utf8/decodeUtf8/v9.d.ts +2 -0
- package/lib/util/buffers/utf8/decodeUtf8/v9.js +39 -0
- package/lib/util/buffers/utf8/decodeUtf8/v9.js.map +1 -0
- package/lib/util/buffers/utf8/encode.d.ts +6 -0
- package/lib/util/buffers/utf8/encode.js +59 -0
- package/lib/util/buffers/utf8/encode.js.map +1 -0
- package/lib/util/buffers/utf8/isUtf8.d.ts +1 -0
- package/lib/util/buffers/utf8/isUtf8.js +43 -0
- package/lib/util/buffers/utf8/isUtf8.js.map +1 -0
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.d.ts +3 -0
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.js +5 -0
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.js.map +1 -0
- package/lib/util/codegen/Codegen.d.ts +44 -0
- package/lib/util/codegen/Codegen.js +121 -0
- package/lib/util/codegen/Codegen.js.map +1 -0
- package/lib/util/codegen/compile.d.ts +4 -0
- package/lib/util/codegen/compile.js +8 -0
- package/lib/util/codegen/compile.js.map +1 -0
- package/lib/util/codegen/dynamicFunction.d.ts +1 -0
- package/lib/util/codegen/dynamicFunction.js +12 -0
- package/lib/util/codegen/dynamicFunction.js.map +1 -0
- package/lib/util/codegen/index.d.ts +3 -0
- package/lib/util/codegen/index.js +7 -0
- package/lib/util/codegen/index.js.map +1 -0
- package/lib/util/codegen/switch.d.ts +1 -0
- package/lib/util/codegen/switch.js +16 -0
- package/lib/util/codegen/switch.js.map +1 -0
- package/lib/util/codegen/types.d.ts +7 -0
- package/lib/util/codegen/types.js +3 -0
- package/lib/util/codegen/types.js.map +1 -0
- package/lib/util/codegen/util/JsExpression.d.ts +11 -0
- package/lib/util/codegen/util/JsExpression.js +30 -0
- package/lib/util/codegen/util/JsExpression.js.map +1 -0
- package/lib/util/codegen/util/helpers.d.ts +1 -0
- package/lib/util/codegen/util/helpers.js +11 -0
- package/lib/util/codegen/util/helpers.js.map +1 -0
- package/lib/util/codegen/util/normalizeAccessor.d.ts +1 -0
- package/lib/util/codegen/util/normalizeAccessor.js +13 -0
- package/lib/util/codegen/util/normalizeAccessor.js.map +1 -0
- package/lib/util/hasOwnProperty.d.ts +1 -0
- package/lib/util/hasOwnProperty.js +9 -0
- package/lib/util/hasOwnProperty.js.map +1 -0
- package/lib/util/isEmpty.d.ts +1 -0
- package/lib/util/isEmpty.js +11 -0
- package/lib/util/isEmpty.js.map +1 -0
- package/lib/util/lazyFunction.d.ts +1 -0
- package/lib/util/lazyFunction.js +14 -0
- package/lib/util/lazyFunction.js.map +1 -0
- package/lib/util/objKeyCmp.d.ts +1 -0
- package/lib/util/objKeyCmp.js +10 -0
- package/lib/util/objKeyCmp.js.map +1 -0
- package/lib/util/sort/insertion.d.ts +1 -0
- package/lib/util/sort/insertion.js +18 -0
- package/lib/util/sort/insertion.js.map +1 -0
- package/lib/util/sort/insertion2.d.ts +1 -0
- package/lib/util/sort/insertion2.js +18 -0
- package/lib/util/sort/insertion2.js.map +1 -0
- package/lib/util/strings/asString.d.ts +1 -0
- package/lib/util/strings/asString.js +28 -0
- package/lib/util/strings/asString.js.map +1 -0
- package/lib/util/strings/escape.d.ts +1 -0
- package/lib/util/strings/escape.js +135 -0
- package/lib/util/strings/escape.js.map +1 -0
- package/lib/util/strings/flatstr.d.ts +1 -0
- package/lib/util/strings/flatstr.js +10 -0
- package/lib/util/strings/flatstr.js.map +1 -0
- package/lib/util/strings/utf8.d.ts +1 -0
- package/lib/util/strings/utf8.js +28 -0
- package/lib/util/strings/utf8.js.map +1 -0
- package/lib/util/strings/util.d.ts +4 -0
- package/lib/util/strings/util.js +12 -0
- package/lib/util/strings/util.js.map +1 -0
- package/lib/util/strings/wordWrap.d.ts +4 -0
- package/lib/util/strings/wordWrap.js +19 -0
- package/lib/util/strings/wordWrap.js.map +1 -0
- package/lib/util/types.d.ts +9 -0
- package/lib/util/types.js +3 -0
- package/lib/util/types.js.map +1 -0
- package/package.json +137 -6
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Writer } from './Writer';
|
|
2
|
+
import type { IReader, IReaderResettable } from './types';
|
|
3
|
+
export declare class StreamingReader implements IReader, IReaderResettable {
|
|
4
|
+
protected readonly writer: Writer;
|
|
5
|
+
protected dx: number;
|
|
6
|
+
constructor(allocSize?: number);
|
|
7
|
+
size(): number;
|
|
8
|
+
protected assertSize(size: number): void;
|
|
9
|
+
push(uint8: Uint8Array): void;
|
|
10
|
+
consume(): void;
|
|
11
|
+
get uint8(): Uint8Array;
|
|
12
|
+
get view(): DataView;
|
|
13
|
+
get x(): number;
|
|
14
|
+
set x(x: number);
|
|
15
|
+
peak(): number;
|
|
16
|
+
skip(length: number): void;
|
|
17
|
+
buf(size: number): Uint8Array;
|
|
18
|
+
u8(): number;
|
|
19
|
+
i8(): number;
|
|
20
|
+
u16(): number;
|
|
21
|
+
i16(): number;
|
|
22
|
+
u32(): number;
|
|
23
|
+
i32(): number;
|
|
24
|
+
u64(): bigint;
|
|
25
|
+
i64(): bigint;
|
|
26
|
+
f32(): number;
|
|
27
|
+
f64(): number;
|
|
28
|
+
utf8(size: number): string;
|
|
29
|
+
ascii(length: number): string;
|
|
30
|
+
reset(uint8: Uint8Array): void;
|
|
31
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StreamingReader = void 0;
|
|
4
|
+
const Writer_1 = require("./Writer");
|
|
5
|
+
const decodeUtf8_1 = require("./utf8/decodeUtf8");
|
|
6
|
+
class StreamingReader {
|
|
7
|
+
constructor(allocSize = 16 * 1024) {
|
|
8
|
+
this.dx = 0;
|
|
9
|
+
this.writer = new Writer_1.Writer(allocSize);
|
|
10
|
+
}
|
|
11
|
+
size() {
|
|
12
|
+
return this.writer.x - this.x;
|
|
13
|
+
}
|
|
14
|
+
assertSize(size) {
|
|
15
|
+
if (size > this.size())
|
|
16
|
+
throw new RangeError('OUT_OF_BOUNDS');
|
|
17
|
+
}
|
|
18
|
+
push(uint8) {
|
|
19
|
+
this.writer.buf(uint8, uint8.length);
|
|
20
|
+
}
|
|
21
|
+
consume() {
|
|
22
|
+
this.writer.x0 += this.dx;
|
|
23
|
+
this.dx = 0;
|
|
24
|
+
}
|
|
25
|
+
get uint8() {
|
|
26
|
+
return this.writer.uint8;
|
|
27
|
+
}
|
|
28
|
+
get view() {
|
|
29
|
+
return this.writer.view;
|
|
30
|
+
}
|
|
31
|
+
get x() {
|
|
32
|
+
return this.writer.x0 + this.dx;
|
|
33
|
+
}
|
|
34
|
+
set x(x) {
|
|
35
|
+
this.dx = x - this.writer.x0;
|
|
36
|
+
}
|
|
37
|
+
peak() {
|
|
38
|
+
this.assertSize(1);
|
|
39
|
+
return this.view.getUint8(this.x);
|
|
40
|
+
}
|
|
41
|
+
skip(length) {
|
|
42
|
+
this.assertSize(length);
|
|
43
|
+
this.x += length;
|
|
44
|
+
}
|
|
45
|
+
buf(size) {
|
|
46
|
+
this.assertSize(size);
|
|
47
|
+
const end = this.x + size;
|
|
48
|
+
const bin = this.uint8.subarray(this.x, end);
|
|
49
|
+
this.x = end;
|
|
50
|
+
return bin;
|
|
51
|
+
}
|
|
52
|
+
u8() {
|
|
53
|
+
this.assertSize(1);
|
|
54
|
+
return this.view.getUint8(this.x++);
|
|
55
|
+
}
|
|
56
|
+
i8() {
|
|
57
|
+
this.assertSize(1);
|
|
58
|
+
return this.view.getInt8(this.x++);
|
|
59
|
+
}
|
|
60
|
+
u16() {
|
|
61
|
+
this.assertSize(2);
|
|
62
|
+
const num = this.view.getUint16(this.x);
|
|
63
|
+
this.x += 2;
|
|
64
|
+
return num;
|
|
65
|
+
}
|
|
66
|
+
i16() {
|
|
67
|
+
this.assertSize(2);
|
|
68
|
+
const num = this.view.getInt16(this.x);
|
|
69
|
+
this.x += 2;
|
|
70
|
+
return num;
|
|
71
|
+
}
|
|
72
|
+
u32() {
|
|
73
|
+
this.assertSize(4);
|
|
74
|
+
const num = this.view.getUint32(this.x);
|
|
75
|
+
this.x += 4;
|
|
76
|
+
return num;
|
|
77
|
+
}
|
|
78
|
+
i32() {
|
|
79
|
+
this.assertSize(4);
|
|
80
|
+
const num = this.view.getInt32(this.x);
|
|
81
|
+
this.x += 4;
|
|
82
|
+
return num;
|
|
83
|
+
}
|
|
84
|
+
u64() {
|
|
85
|
+
this.assertSize(8);
|
|
86
|
+
const num = this.view.getBigUint64(this.x);
|
|
87
|
+
this.x += 8;
|
|
88
|
+
return num;
|
|
89
|
+
}
|
|
90
|
+
i64() {
|
|
91
|
+
this.assertSize(8);
|
|
92
|
+
const num = this.view.getBigInt64(this.x);
|
|
93
|
+
this.x += 8;
|
|
94
|
+
return num;
|
|
95
|
+
}
|
|
96
|
+
f32() {
|
|
97
|
+
this.assertSize(4);
|
|
98
|
+
const pos = this.x;
|
|
99
|
+
this.x += 4;
|
|
100
|
+
return this.view.getFloat32(pos);
|
|
101
|
+
}
|
|
102
|
+
f64() {
|
|
103
|
+
this.assertSize(8);
|
|
104
|
+
const pos = this.x;
|
|
105
|
+
this.x += 8;
|
|
106
|
+
return this.view.getFloat64(pos);
|
|
107
|
+
}
|
|
108
|
+
utf8(size) {
|
|
109
|
+
this.assertSize(size);
|
|
110
|
+
const start = this.x;
|
|
111
|
+
this.x += size;
|
|
112
|
+
return (0, decodeUtf8_1.decodeUtf8)(this.uint8, start, size);
|
|
113
|
+
}
|
|
114
|
+
ascii(length) {
|
|
115
|
+
this.assertSize(length);
|
|
116
|
+
const uint8 = this.uint8;
|
|
117
|
+
let str = '';
|
|
118
|
+
const end = this.x + length;
|
|
119
|
+
for (let i = this.x; i < end; i++)
|
|
120
|
+
str += String.fromCharCode(uint8[i]);
|
|
121
|
+
this.x = end;
|
|
122
|
+
return str;
|
|
123
|
+
}
|
|
124
|
+
reset(uint8) {
|
|
125
|
+
this.dx = 0;
|
|
126
|
+
this.writer.reset();
|
|
127
|
+
this.push(uint8);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.StreamingReader = StreamingReader;
|
|
131
|
+
//# sourceMappingURL=StreamingReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StreamingReader.js","sourceRoot":"","sources":["../../../src/util/buffers/StreamingReader.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAChC,kDAA6C;AAG7C,MAAa,eAAe;IAQ1B,YAAY,YAAoB,EAAE,GAAG,IAAI;QAF/B,OAAE,GAAG,CAAC,CAAC;QAGf,IAAI,CAAC,MAAM,GAAG,IAAI,eAAM,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAKM,IAAI;QACT,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAChC,CAAC;IAOS,UAAU,CAAC,IAAY;QAC/B,IAAI,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE;YAAE,MAAM,IAAI,UAAU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C,MAAM,CAAC,CAAC;QACxB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;QAC5B,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE;YAAE,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,CAAC,GAAG,GAAG,CAAC;QACb,OAAO,GAAG,CAAC;IACb,CAAC;IAIM,KAAK,CAAC,KAAiB;QAC5B,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACZ,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnB,CAAC;CACF;AA9KD,0CA8KC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Uint8ArrayCut = void 0;
|
|
4
|
+
class Uint8ArrayCut {
|
|
5
|
+
constructor(uint8, start, size) {
|
|
6
|
+
this.uint8 = uint8;
|
|
7
|
+
this.start = start;
|
|
8
|
+
this.size = size;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.Uint8ArrayCut = Uint8ArrayCut;
|
|
12
|
+
//# sourceMappingURL=Uint8ArrayCut.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Uint8ArrayCut.js","sourceRoot":"","sources":["../../../src/util/buffers/Uint8ArrayCut.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IACxB,YACkB,KAAiB,EACjB,KAAa,EACb,IAAY;QAFZ,UAAK,GAAL,KAAK,CAAY;QACjB,UAAK,GAAL,KAAK,CAAQ;QACb,SAAI,GAAJ,IAAI,CAAQ;IAC3B,CAAC;CACL;AAND,sCAMC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Slice } from './Slice';
|
|
2
|
+
import { IWriterGrowable, IWriter } from './types';
|
|
3
|
+
export declare class Writer implements IWriter, IWriterGrowable {
|
|
4
|
+
allocSize: number;
|
|
5
|
+
uint8: Uint8Array;
|
|
6
|
+
view: DataView;
|
|
7
|
+
x0: number;
|
|
8
|
+
x: number;
|
|
9
|
+
protected size: number;
|
|
10
|
+
constructor(allocSize?: number);
|
|
11
|
+
protected grow(size: number): void;
|
|
12
|
+
ensureCapacity(capacity: number): void;
|
|
13
|
+
move(capacity: number): void;
|
|
14
|
+
reset(): void;
|
|
15
|
+
newBuffer(size: number): void;
|
|
16
|
+
flush(): Uint8Array;
|
|
17
|
+
flushSlice(): Slice;
|
|
18
|
+
u8(char: number): void;
|
|
19
|
+
u16(word: number): void;
|
|
20
|
+
u32(dword: number): void;
|
|
21
|
+
i32(dword: number): void;
|
|
22
|
+
u64(qword: number | bigint): void;
|
|
23
|
+
f64(float: number): void;
|
|
24
|
+
u8u16(u8: number, u16: number): void;
|
|
25
|
+
u8u32(u8: number, u32: number): void;
|
|
26
|
+
u8u64(u8: number, u64: number | bigint): void;
|
|
27
|
+
u8f32(u8: number, f32: number): void;
|
|
28
|
+
u8f64(u8: number, f64: number): void;
|
|
29
|
+
buf(buf: Uint8Array, length: number): void;
|
|
30
|
+
utf8(str: string): number;
|
|
31
|
+
utf8Native(str: string): number;
|
|
32
|
+
ascii(str: string): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Writer = void 0;
|
|
4
|
+
const Slice_1 = require("./Slice");
|
|
5
|
+
const EMPTY_UINT8 = new Uint8Array([]);
|
|
6
|
+
const EMPTY_VIEW = new DataView(EMPTY_UINT8.buffer);
|
|
7
|
+
const hasBuffer = typeof Buffer === 'function';
|
|
8
|
+
const utf8Write = hasBuffer
|
|
9
|
+
? Buffer.prototype.utf8Write
|
|
10
|
+
: null;
|
|
11
|
+
const from = hasBuffer ? Buffer.from : null;
|
|
12
|
+
const textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null;
|
|
13
|
+
class Writer {
|
|
14
|
+
constructor(allocSize = 64 * 1024) {
|
|
15
|
+
this.allocSize = allocSize;
|
|
16
|
+
this.view = EMPTY_VIEW;
|
|
17
|
+
this.x0 = 0;
|
|
18
|
+
this.x = 0;
|
|
19
|
+
this.uint8 = new Uint8Array(allocSize);
|
|
20
|
+
this.size = allocSize;
|
|
21
|
+
this.view = new DataView(this.uint8.buffer);
|
|
22
|
+
}
|
|
23
|
+
grow(size) {
|
|
24
|
+
const x0 = this.x0;
|
|
25
|
+
const x = this.x;
|
|
26
|
+
const oldUint8 = this.uint8;
|
|
27
|
+
const newUint8 = new Uint8Array(size);
|
|
28
|
+
const view = new DataView(newUint8.buffer);
|
|
29
|
+
const activeSlice = oldUint8.subarray(x0, x);
|
|
30
|
+
newUint8.set(activeSlice, 0);
|
|
31
|
+
this.x = x - x0;
|
|
32
|
+
this.x0 = 0;
|
|
33
|
+
this.uint8 = newUint8;
|
|
34
|
+
this.size = size;
|
|
35
|
+
this.view = view;
|
|
36
|
+
}
|
|
37
|
+
ensureCapacity(capacity) {
|
|
38
|
+
const byteLength = this.size;
|
|
39
|
+
const remaining = byteLength - this.x;
|
|
40
|
+
if (remaining < capacity) {
|
|
41
|
+
const total = byteLength - this.x0;
|
|
42
|
+
const required = capacity - remaining;
|
|
43
|
+
const totalRequired = total + required;
|
|
44
|
+
this.grow(totalRequired <= this.allocSize ? this.allocSize : totalRequired * 2);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
move(capacity) {
|
|
48
|
+
this.ensureCapacity(capacity);
|
|
49
|
+
this.x += capacity;
|
|
50
|
+
}
|
|
51
|
+
reset() {
|
|
52
|
+
this.x0 = this.x;
|
|
53
|
+
}
|
|
54
|
+
newBuffer(size) {
|
|
55
|
+
const uint8 = (this.uint8 = new Uint8Array(size));
|
|
56
|
+
this.size = size;
|
|
57
|
+
this.view = new DataView(uint8.buffer);
|
|
58
|
+
this.x = this.x0 = 0;
|
|
59
|
+
}
|
|
60
|
+
flush() {
|
|
61
|
+
const result = this.uint8.subarray(this.x0, this.x);
|
|
62
|
+
this.x0 = this.x;
|
|
63
|
+
return result;
|
|
64
|
+
}
|
|
65
|
+
flushSlice() {
|
|
66
|
+
const slice = new Slice_1.Slice(this.uint8, this.view, this.x0, this.x);
|
|
67
|
+
this.x0 = this.x;
|
|
68
|
+
return slice;
|
|
69
|
+
}
|
|
70
|
+
u8(char) {
|
|
71
|
+
this.ensureCapacity(1);
|
|
72
|
+
this.uint8[this.x++] = char;
|
|
73
|
+
}
|
|
74
|
+
u16(word) {
|
|
75
|
+
this.ensureCapacity(2);
|
|
76
|
+
this.view.setUint16(this.x, word);
|
|
77
|
+
this.x += 2;
|
|
78
|
+
}
|
|
79
|
+
u32(dword) {
|
|
80
|
+
this.ensureCapacity(4);
|
|
81
|
+
this.view.setUint32(this.x, dword);
|
|
82
|
+
this.x += 4;
|
|
83
|
+
}
|
|
84
|
+
i32(dword) {
|
|
85
|
+
this.ensureCapacity(4);
|
|
86
|
+
this.view.setInt32(this.x, dword);
|
|
87
|
+
this.x += 4;
|
|
88
|
+
}
|
|
89
|
+
u64(qword) {
|
|
90
|
+
this.ensureCapacity(8);
|
|
91
|
+
this.view.setBigUint64(this.x, BigInt(qword));
|
|
92
|
+
this.x += 8;
|
|
93
|
+
}
|
|
94
|
+
f64(float) {
|
|
95
|
+
this.ensureCapacity(8);
|
|
96
|
+
this.view.setFloat64(this.x, float);
|
|
97
|
+
this.x += 8;
|
|
98
|
+
}
|
|
99
|
+
u8u16(u8, u16) {
|
|
100
|
+
this.ensureCapacity(3);
|
|
101
|
+
let x = this.x;
|
|
102
|
+
this.uint8[x++] = u8;
|
|
103
|
+
this.uint8[x++] = u16 >>> 8;
|
|
104
|
+
this.uint8[x++] = u16 & 0xff;
|
|
105
|
+
this.x = x;
|
|
106
|
+
}
|
|
107
|
+
u8u32(u8, u32) {
|
|
108
|
+
this.ensureCapacity(5);
|
|
109
|
+
let x = this.x;
|
|
110
|
+
this.uint8[x++] = u8;
|
|
111
|
+
this.view.setUint32(x, u32);
|
|
112
|
+
this.x = x + 4;
|
|
113
|
+
}
|
|
114
|
+
u8u64(u8, u64) {
|
|
115
|
+
this.ensureCapacity(9);
|
|
116
|
+
let x = this.x;
|
|
117
|
+
this.uint8[x++] = u8;
|
|
118
|
+
this.view.setBigUint64(x, BigInt(u64));
|
|
119
|
+
this.x = x + 8;
|
|
120
|
+
}
|
|
121
|
+
u8f32(u8, f32) {
|
|
122
|
+
this.ensureCapacity(5);
|
|
123
|
+
let x = this.x;
|
|
124
|
+
this.uint8[x++] = u8;
|
|
125
|
+
this.view.setFloat32(x, f32);
|
|
126
|
+
this.x = x + 4;
|
|
127
|
+
}
|
|
128
|
+
u8f64(u8, f64) {
|
|
129
|
+
this.ensureCapacity(9);
|
|
130
|
+
let x = this.x;
|
|
131
|
+
this.uint8[x++] = u8;
|
|
132
|
+
this.view.setFloat64(x, f64);
|
|
133
|
+
this.x = x + 8;
|
|
134
|
+
}
|
|
135
|
+
buf(buf, length) {
|
|
136
|
+
this.ensureCapacity(length);
|
|
137
|
+
const x = this.x;
|
|
138
|
+
this.uint8.set(buf, x);
|
|
139
|
+
this.x = x + length;
|
|
140
|
+
}
|
|
141
|
+
utf8(str) {
|
|
142
|
+
const maxLength = str.length * 4;
|
|
143
|
+
if (maxLength < 168)
|
|
144
|
+
return this.utf8Native(str);
|
|
145
|
+
if (utf8Write) {
|
|
146
|
+
const writeLength = utf8Write.call(this.uint8, str, this.x, maxLength);
|
|
147
|
+
this.x += writeLength;
|
|
148
|
+
return writeLength;
|
|
149
|
+
}
|
|
150
|
+
else if (from) {
|
|
151
|
+
const uint8 = this.uint8;
|
|
152
|
+
const offset = uint8.byteOffset + this.x;
|
|
153
|
+
const buf = from(uint8.buffer).subarray(offset, offset + maxLength);
|
|
154
|
+
const writeLength = buf.write(str, 0, maxLength, 'utf8');
|
|
155
|
+
this.x += writeLength;
|
|
156
|
+
return writeLength;
|
|
157
|
+
}
|
|
158
|
+
else if (maxLength > 1024 && textEncoder) {
|
|
159
|
+
const writeLength = textEncoder.encodeInto(str, this.uint8.subarray(this.x, this.x + maxLength)).written;
|
|
160
|
+
this.x += writeLength;
|
|
161
|
+
return writeLength;
|
|
162
|
+
}
|
|
163
|
+
return this.utf8Native(str);
|
|
164
|
+
}
|
|
165
|
+
utf8Native(str) {
|
|
166
|
+
const length = str.length;
|
|
167
|
+
const uint8 = this.uint8;
|
|
168
|
+
let offset = this.x;
|
|
169
|
+
let pos = 0;
|
|
170
|
+
while (pos < length) {
|
|
171
|
+
let value = str.charCodeAt(pos++);
|
|
172
|
+
if ((value & 0xffffff80) === 0) {
|
|
173
|
+
uint8[offset++] = value;
|
|
174
|
+
continue;
|
|
175
|
+
}
|
|
176
|
+
else if ((value & 0xfffff800) === 0) {
|
|
177
|
+
uint8[offset++] = ((value >> 6) & 0x1f) | 0xc0;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
if (value >= 0xd800 && value <= 0xdbff) {
|
|
181
|
+
if (pos < length) {
|
|
182
|
+
const extra = str.charCodeAt(pos);
|
|
183
|
+
if ((extra & 0xfc00) === 0xdc00) {
|
|
184
|
+
pos++;
|
|
185
|
+
value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
if ((value & 0xffff0000) === 0) {
|
|
190
|
+
uint8[offset++] = ((value >> 12) & 0x0f) | 0xe0;
|
|
191
|
+
uint8[offset++] = ((value >> 6) & 0x3f) | 0x80;
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
uint8[offset++] = ((value >> 18) & 0x07) | 0xf0;
|
|
195
|
+
uint8[offset++] = ((value >> 12) & 0x3f) | 0x80;
|
|
196
|
+
uint8[offset++] = ((value >> 6) & 0x3f) | 0x80;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
uint8[offset++] = (value & 0x3f) | 0x80;
|
|
200
|
+
}
|
|
201
|
+
const writeLength = offset - this.x;
|
|
202
|
+
this.x = offset;
|
|
203
|
+
return writeLength;
|
|
204
|
+
}
|
|
205
|
+
ascii(str) {
|
|
206
|
+
const length = str.length;
|
|
207
|
+
this.ensureCapacity(length);
|
|
208
|
+
const uint8 = this.uint8;
|
|
209
|
+
let x = this.x;
|
|
210
|
+
let pos = 0;
|
|
211
|
+
while (pos < length)
|
|
212
|
+
uint8[x++] = str.charCodeAt(pos++);
|
|
213
|
+
this.x = x;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
exports.Writer = Writer;
|
|
217
|
+
//# sourceMappingURL=Writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Writer.js","sourceRoot":"","sources":["../../../src/util/buffers/Writer.ts"],"names":[],"mappings":";;;AAAA,mCAA8B;AAG9B,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACvC,MAAM,UAAU,GAAG,IAAI,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAEpD,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC;AAC/C,MAAM,SAAS,GAAG,SAAS;IACzB,CAAC,CAAE,MAAM,CAAC,SAAS,CAAC,SAAuF;IAC3G,CAAC,CAAC,IAAI,CAAC;AACT,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,MAAM,WAAW,GAAG,OAAO,WAAW,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC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AI,CAAC,GAAG,IAAI,CAAC;oBAChD,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;oBAChD,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;gBACjD,CAAC;YACH,CAAC;YACD,KAAK,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;QAC1C,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;QACpC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC;QAChB,OAAO,WAAW,CAAC;IACrB,CAAC;IAEM,KAAK,CAAC,GAAW;QACtB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;QACf,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,OAAO,GAAG,GAAG,MAAM;YAAE,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;QACxD,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF;AA1PD,wBA0PC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const b: (...args: number[]) => Uint8Array;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"b.js","sourceRoot":"","sources":["../../../src/util/buffers/b.ts"],"names":[],"mappings":";;;AAAO,MAAM,CAAC,GAAG,CAAC,GAAG,IAAc,EAAE,EAAE,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;AAAhD,QAAA,CAAC,KAA+C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bufferToUint8Array = void 0;
|
|
4
|
+
const bufferToUint8Array = (buf) => new Uint8Array(buf.buffer, buf.byteOffset, buf.length);
|
|
5
|
+
exports.bufferToUint8Array = bufferToUint8Array;
|
|
6
|
+
//# sourceMappingURL=bufferToUint8Array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bufferToUint8Array.js","sourceRoot":"","sources":["../../../src/util/buffers/bufferToUint8Array.ts"],"names":[],"mappings":";;;AAAO,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAc,EAAE,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;AAAzG,QAAA,kBAAkB,sBAAuF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cmpUint8Array: (a: Uint8Array, b: Uint8Array) => boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cmpUint8Array = void 0;
|
|
4
|
+
const cmpUint8Array = (a, b) => {
|
|
5
|
+
const length = a.length;
|
|
6
|
+
if (length !== b.length)
|
|
7
|
+
return false;
|
|
8
|
+
for (let i = 0; i < length; i++)
|
|
9
|
+
if (a[i] !== b[i])
|
|
10
|
+
return false;
|
|
11
|
+
return true;
|
|
12
|
+
};
|
|
13
|
+
exports.cmpUint8Array = cmpUint8Array;
|
|
14
|
+
//# sourceMappingURL=cmpUint8Array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmpUint8Array.js","sourceRoot":"","sources":["../../../src/util/buffers/cmpUint8Array.ts"],"names":[],"mappings":";;;AAAO,MAAM,aAAa,GAAG,CAAC,CAAa,EAAE,CAAa,EAAW,EAAE;IACrE,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACxB,IAAI,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAAE,OAAO,KAAK,CAAC;IACjE,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AALW,QAAA,aAAa,iBAKxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cmpUint8Array2: (a: Uint8Array, b: Uint8Array) => number;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cmpUint8Array2 = void 0;
|
|
4
|
+
const cmpUint8Array2 = (a, b) => {
|
|
5
|
+
const len1 = a.length;
|
|
6
|
+
const len2 = b.length;
|
|
7
|
+
const len = Math.min(len1, len2);
|
|
8
|
+
for (let i = 0; i < len; i++) {
|
|
9
|
+
const diffChar = a[i] - b[i];
|
|
10
|
+
if (diffChar !== 0)
|
|
11
|
+
return diffChar;
|
|
12
|
+
}
|
|
13
|
+
return len1 - len2;
|
|
14
|
+
};
|
|
15
|
+
exports.cmpUint8Array2 = cmpUint8Array2;
|
|
16
|
+
//# sourceMappingURL=cmpUint8Array2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmpUint8Array2.js","sourceRoot":"","sources":["../../../src/util/buffers/cmpUint8Array2.ts"],"names":[],"mappings":";;;AAQO,MAAM,cAAc,GAAG,CAAC,CAAa,EAAE,CAAa,EAAU,EAAE;IACrE,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7B,IAAI,QAAQ,KAAK,CAAC;YAAE,OAAO,QAAQ,CAAC;IACtC,CAAC;IACD,OAAO,IAAI,GAAG,IAAI,CAAC;AACrB,CAAC,CAAC;AATW,QAAA,cAAc,kBASzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cmpUint8Array3: (a: Uint8Array, b: Uint8Array) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cmpUint8Array3 = void 0;
|
|
4
|
+
const cmpUint8Array3 = (a, b) => {
|
|
5
|
+
const len1 = a.length;
|
|
6
|
+
const len2 = b.length;
|
|
7
|
+
const diff = len1 - len2;
|
|
8
|
+
if (diff !== 0)
|
|
9
|
+
return diff;
|
|
10
|
+
for (let i = 0; i < len1; i++) {
|
|
11
|
+
const diff = a[i] - b[i];
|
|
12
|
+
if (diff !== 0)
|
|
13
|
+
return diff;
|
|
14
|
+
}
|
|
15
|
+
return 0;
|
|
16
|
+
};
|
|
17
|
+
exports.cmpUint8Array3 = cmpUint8Array3;
|
|
18
|
+
//# sourceMappingURL=cmpUint8Array3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmpUint8Array3.js","sourceRoot":"","sources":["../../../src/util/buffers/cmpUint8Array3.ts"],"names":[],"mappings":";;;AAQO,MAAM,cAAc,GAAG,CAAC,CAAa,EAAE,CAAa,EAAU,EAAE;IACrE,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC;IACtB,MAAM,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IACzB,IAAI,IAAI,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACzB,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAVW,QAAA,cAAc,kBAUzB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listToUint8 = exports.concatList = exports.concat = void 0;
|
|
4
|
+
const concat = (a, b) => {
|
|
5
|
+
const res = new Uint8Array(a.length + b.length);
|
|
6
|
+
res.set(a);
|
|
7
|
+
res.set(b, a.length);
|
|
8
|
+
return res;
|
|
9
|
+
};
|
|
10
|
+
exports.concat = concat;
|
|
11
|
+
const concatList = (list) => {
|
|
12
|
+
const length = list.length;
|
|
13
|
+
let size = 0, offset = 0;
|
|
14
|
+
for (let i = 0; i < length; i++)
|
|
15
|
+
size += list[i].length;
|
|
16
|
+
const res = new Uint8Array(size);
|
|
17
|
+
for (let i = 0; i < length; i++) {
|
|
18
|
+
const item = list[i];
|
|
19
|
+
res.set(item, offset);
|
|
20
|
+
offset += item.length;
|
|
21
|
+
}
|
|
22
|
+
return res;
|
|
23
|
+
};
|
|
24
|
+
exports.concatList = concatList;
|
|
25
|
+
const listToUint8 = (list) => {
|
|
26
|
+
switch (list.length) {
|
|
27
|
+
case 0:
|
|
28
|
+
return new Uint8Array(0);
|
|
29
|
+
case 1:
|
|
30
|
+
return list[0];
|
|
31
|
+
default:
|
|
32
|
+
return (0, exports.concatList)(list);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
exports.listToUint8 = listToUint8;
|
|
36
|
+
//# sourceMappingURL=concat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/util/buffers/concat.ts"],"names":[],"mappings":";;;AAAO,MAAM,MAAM,GAAG,CAAC,CAAa,EAAE,CAAa,EAAc,EAAE;IACjE,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAChD,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACX,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IACrB,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AALW,QAAA,MAAM,UAKjB;AAEK,MAAM,UAAU,GAAG,CAAC,IAAkB,EAAc,EAAE;IAC3D,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC3B,IAAI,IAAI,GAAG,CAAC,EACV,MAAM,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACxD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC;IACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACrB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtB,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC;IACxB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB;AAEK,MAAM,WAAW,GAAG,CAAC,IAAkB,EAAc,EAAE;IAC5D,QAAQ,IAAI,CAAC,MAAM,EAAE,CAAC;QACpB,KAAK,CAAC;YACJ,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;QAC3B,KAAK,CAAC;YACJ,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC;QACjB;YACE,OAAO,IAAA,kBAAU,EAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AATW,QAAA,WAAW,eAStB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const copy: <T extends Uint8Array>(arr: T) => T;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.copy = void 0;
|
|
4
|
+
const copy = (arr) => {
|
|
5
|
+
const dupe = new Uint8Array(arr.length);
|
|
6
|
+
dupe.set(arr);
|
|
7
|
+
return dupe;
|
|
8
|
+
};
|
|
9
|
+
exports.copy = copy;
|
|
10
|
+
//# sourceMappingURL=copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy.js","sourceRoot":"","sources":["../../../src/util/buffers/copy.ts"],"names":[],"mappings":";;;AAAO,MAAM,IAAI,GAAG,CAAuB,GAAM,EAAK,EAAE;IACtD,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAM,CAAC;IAC7C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACd,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,IAAI,QAIf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const decodeF16: (binary: number) => number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.decodeF16 = void 0;
|
|
4
|
+
const pow = Math.pow;
|
|
5
|
+
const decodeF16 = (binary) => {
|
|
6
|
+
const exponent = (binary & 0x7c00) >> 10;
|
|
7
|
+
const fraction = binary & 0x03ff;
|
|
8
|
+
return ((binary >> 15 ? -1 : 1) *
|
|
9
|
+
(exponent
|
|
10
|
+
? exponent === 0x1f
|
|
11
|
+
? fraction
|
|
12
|
+
? NaN
|
|
13
|
+
: Infinity
|
|
14
|
+
: pow(2, exponent - 15) * (1 + fraction / 0x400)
|
|
15
|
+
: 6.103515625e-5 * (fraction / 0x400)));
|
|
16
|
+
};
|
|
17
|
+
exports.decodeF16 = decodeF16;
|
|
18
|
+
//# sourceMappingURL=f16.js.map
|