@amodx/binary 0.0.16 → 0.0.20

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.
@@ -1,4 +1,4 @@
1
- import { BinaryArrays } from "../Util/BinaryArrays";
1
+ import { BinaryArrays } from "../Util/BinaryArrays.js";
2
2
  export class BitArray {
3
3
  buffer;
4
4
  data;
@@ -1,4 +1,4 @@
1
- import { BinaryArrays } from "../Util/BinaryArrays";
1
+ import { BinaryArrays } from "../Util/BinaryArrays.js";
2
2
  export class HalfNibbleArray {
3
3
  buffer;
4
4
  data;
@@ -1,4 +1,4 @@
1
- import { BinaryArrays } from "../Util/BinaryArrays";
1
+ import { BinaryArrays } from "../Util/BinaryArrays.js";
2
2
  export class NibbleArray {
3
3
  buffer;
4
4
  data;
@@ -21,7 +21,9 @@ export class ObjectToTypedNodes {
21
21
  node.value[key] = this._addPrimitive(value);
22
22
  continue;
23
23
  }
24
- if (value instanceof ArrayBuffer || value instanceof SharedArrayBuffer) {
24
+ if (value instanceof ArrayBuffer ||
25
+ (typeof SharedArrayBuffer !== "undefined" &&
26
+ value instanceof SharedArrayBuffer)) {
25
27
  node.value[key] = this._addPrimitive(value);
26
28
  continue;
27
29
  }
@@ -86,7 +88,9 @@ export class ObjectToTypedNodes {
86
88
  if (typeof node == "undefined") {
87
89
  return TypedNodes.undefined();
88
90
  }
89
- if (node instanceof ArrayBuffer || node instanceof SharedArrayBuffer) {
91
+ if (node instanceof ArrayBuffer ||
92
+ (typeof SharedArrayBuffer !== "undefined" &&
93
+ node instanceof SharedArrayBuffer)) {
90
94
  return TypedNodes.arrayBuffer(node);
91
95
  }
92
96
  if (ArrayBuffer.isView(node)) {
@@ -1,9 +1,9 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export declare class BinaryUtil {
3
3
  static setTypedNumber(data: DataView, index: number, numberType: BinaryNumberTypes, value: number): void;
4
4
  static getTypedNumber(data: DataView, index: number, numberType: BinaryNumberTypes): number;
5
5
  static calculateBitsNeeded(min: number, max: number): number;
6
- static getTypedSize(type: BinaryNumberTypes): import("../Constants/BinaryTypes").ByteCounts;
6
+ static getTypedSize(type: BinaryNumberTypes): import("../Constants/BinaryTypes.js").ByteCounts;
7
7
  static getBitValue(data: number, bitIndex: number, bitSize: number): number;
8
8
  static setBitValue(data: number, bitIndex: number, value: number, bitSize: number): number;
9
9
  }
@@ -1,6 +1,6 @@
1
- import { ByteDataGet } from "./ByteDataGet";
2
- import { MappedByteCounts } from "../Constants/BinaryTypes";
3
- import { ByteDataSet } from "../Util/ByteDataSet";
1
+ import { ByteDataGet } from "./ByteDataGet.js";
2
+ import { MappedByteCounts } from "../Constants/BinaryTypes.js";
3
+ import { ByteDataSet } from "../Util/ByteDataSet.js";
4
4
  export class BinaryUtil {
5
5
  static setTypedNumber(data, index, numberType, value) {
6
6
  return ByteDataSet[numberType](data, index, value);
@@ -1,2 +1,2 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export declare const ByteDataGet: Record<BinaryNumberTypes, (dv: DataView, index: number) => number>;
@@ -1,4 +1,4 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export const ByteDataGet = {
3
3
  [BinaryNumberTypes.Int8]: (dv, index) => dv.getInt8(index),
4
4
  [BinaryNumberTypes.Uint8]: (dv, index) => dv.getUint8(index),
@@ -1,2 +1,2 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export declare const ByteDataSet: Record<BinaryNumberTypes, (dv: DataView, index: number, value: number | bigint) => void>;
@@ -1,4 +1,4 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export const ByteDataSet = {
3
3
  [BinaryNumberTypes.Int8]: (dv, index, value) => dv.setInt8(index, value),
4
4
  [BinaryNumberTypes.Uint8]: (dv, index, value) => dv.setUint8(index, value),
@@ -1,4 +1,4 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export declare class ByteEncoder {
3
3
  static view: DataView<ArrayBuffer>;
4
4
  static count: number;
@@ -1,5 +1,5 @@
1
- import { MappedByteCounts } from "../Constants/BinaryTypes";
2
- import { ByteDataSet } from "./ByteDataSet";
1
+ import { MappedByteCounts } from "../Constants/BinaryTypes.js";
2
+ import { ByteDataSet } from "./ByteDataSet.js";
3
3
  export class ByteEncoder {
4
4
  static view = new DataView(new ArrayBuffer(8));
5
5
  static count = 0;
@@ -1,3 +1,3 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
2
- import { TypedArrays } from "./TypedArrays";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
+ import { TypedArrays } from "./TypedArrays.js";
3
3
  export declare const TypedArrayCreate: Record<BinaryNumberTypes, (length: number, sharedMemory?: boolean) => TypedArrays>;
@@ -1,4 +1,4 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export const TypedArrayCreate = {
3
3
  [BinaryNumberTypes.Int8]: (length, sharedMemory = false) => new Int8Array(sharedMemory
4
4
  ? new SharedArrayBuffer(length * Int8Array.BYTES_PER_ELEMENT)
@@ -1,4 +1,4 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
2
- import { TypedArrayClasses } from "./TypedArrays";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
+ import { TypedArrayClasses } from "./TypedArrays.js";
3
3
  export declare const TypedArrayClassMap: Record<BinaryNumberTypes, TypedArrayClasses>;
4
4
  export declare const TypedArrayClassRecord: Map<TypedArrayClasses, BinaryNumberTypes>;
@@ -1,4 +1,4 @@
1
- import { BinaryNumberTypes } from "../Constants/BinaryTypes";
1
+ import { BinaryNumberTypes } from "../Constants/BinaryTypes.js";
2
2
  export const TypedArrayClassMap = {
3
3
  [BinaryNumberTypes.Int8]: Int8Array,
4
4
  [BinaryNumberTypes.Uint8]: Uint8Array,
package/Util/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./TypedArrays";
2
- export * from "./TypedArrayMap";
1
+ export * from "./TypedArrays.js";
2
+ export * from "./TypedArrayMap.js";
package/Util/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./TypedArrays";
2
- export * from "./TypedArrayMap";
1
+ export * from "./TypedArrays.js";
2
+ export * from "./TypedArrayMap.js";
package/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./Object/index";
2
- export * from "./Struct/index";
3
- export * from "./Constants/BinaryTypes";
4
- export * from "./Util/index";
1
+ export * from "./Object/index.js";
2
+ export * from "./Struct/index.js";
3
+ export * from "./Constants/BinaryTypes.js";
4
+ export * from "./Util/index.js";
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./Object/index";
2
- export * from "./Struct/index";
3
- export * from "./Constants/BinaryTypes";
4
- export * from "./Util/index";
1
+ export * from "./Object/index.js";
2
+ export * from "./Struct/index.js";
3
+ export * from "./Constants/BinaryTypes.js";
4
+ export * from "./Util/index.js";
package/package.json CHANGED
@@ -1,27 +1 @@
1
- {
2
- "name": "@amodx/binary",
3
- "version": "0.0.16",
4
- "module": "index.js",
5
- "types": "index.d.ts",
6
- "type": "module",
7
- "keywords": [],
8
- "description": "Binary objects and binary tags.",
9
- "scripts": {
10
- "build": "mkdir -p dist && rm -rf dist/* && cp package.json dist/package.json && cd ./src && npx tsc",
11
- "compile": "cd ./src && npx tsc --watch"
12
- },
13
- "repository": {
14
- "url": "git+https://github.com/Amodx/Libraries.git"
15
- },
16
- "bugs": {
17
- "url": "https://github.com/Amodx/Libraries/issues"
18
- },
19
- "homepage": "https://github.com/Amodx/Libraries",
20
- "author": "Amodx",
21
- "license": "MIT",
22
- "devDependencies": {},
23
- "main": "index.js",
24
- "publishConfig": {
25
- "access": "public"
26
- }
27
- }
1
+ {"name":"@amodx/binary","version":"0.0.20","module":"index.js","types":"index.d.ts","type":"module","keywords":[],"description":"Binary objects and binary tags.","scripts":{"build":"mkdir -p dist && rm -rf dist/* && cp package.json dist/package.json && cd ./src && npx tsc","compile":"cd ./src && npx tsc --watch"},"repository":{"url":"git+https://github.com/Amodx/Libraries.git"},"bugs":{"url":"https://github.com/Amodx/Libraries/issues"},"homepage":"https://github.com/Amodx/Libraries","author":"Amodx","license":"MIT","devDependencies":{},"main":"index.js","publishConfig":{"access":"public"}}