@bare-ts/lib
Version:
TypeScript library for BARE, a compact and simple binary-serialization format
16 lines (15 loc) • 790 B
JavaScript
//! Copyright (c) 2022 Victorien Elvinger
//! Licensed under the MIT License (https://mit-license.org/)
// To make constants inlinable by bundlers like esbuild, we group them in this module.
// The module must be without any imports.
export const TEXT_DECODER_THRESHOLD = 256;
export const TEXT_ENCODER_THRESHOLD = 256;
export const INT_SAFE_MAX_BYTE_COUNT = 8;
export const UINT_MAX_BYTE_COUNT = 10;
export const UINT_SAFE32_MAX_BYTE_COUNT = 5;
export const INVALID_UTF8_STRING = "invalid UTF-8 string";
export const NON_CANONICAL_REPRESENTATION = "must be canonical";
export const TOO_LARGE_BUFFER = "too large buffer";
export const TOO_LARGE_NUMBER = "too large number";
export const IS_LITTLE_ENDIAN_PLATFORM =
/* @__PURE__ */ new DataView(Uint16Array.of(1).buffer).getUint8(0) === 1;