@hazae41/binary
Advanced tools
Comparing version 1.2.34 to 1.2.35
@@ -1,6 +0,6 @@ | ||
import { BytesCastError, BytesAllocError } from '@hazae41/bytes'; | ||
import { BytesError } from '@hazae41/bytes'; | ||
import { CursorReadError, Cursor, CursorWriteError } from '@hazae41/cursor'; | ||
type BinaryError = BinaryReadError | BinaryWriteError; | ||
type BinaryReadError = BytesCastError | CursorReadLengthUnderflowError | CursorReadError; | ||
type BinaryReadError = BytesError | CursorReadLengthUnderflowError | CursorReadError; | ||
declare class CursorReadLengthUnderflowError extends Error { | ||
@@ -14,3 +14,3 @@ #private; | ||
} | ||
type BinaryWriteError = BytesAllocError | CursorWriteLenghtUnderflowError | CursorWriteError; | ||
type BinaryWriteError = BytesError | CursorWriteLenghtUnderflowError | CursorWriteError; | ||
declare class CursorWriteLenghtUnderflowError extends Error { | ||
@@ -17,0 +17,0 @@ #private; |
@@ -1,2 +0,2 @@ | ||
import { Bytes, BytesAllocError, Sized } from '@hazae41/bytes'; | ||
import { Bytes } from '@hazae41/bytes'; | ||
import { Cursor } from '@hazae41/cursor'; | ||
@@ -17,65 +17,2 @@ import { Result } from '@hazae41/result'; | ||
/** | ||
* Bytes.empty | ||
* @deprecated | ||
* @returns | ||
*/ | ||
static empty(): Opaque<Bytes<0>>; | ||
/** | ||
* Bytes.tryEmpty | ||
* @returns | ||
*/ | ||
static tryEmpty(): Result<Opaque<Bytes<0>>, BytesAllocError<0>>; | ||
/** | ||
* Bytes.alloc | ||
* @deprecated | ||
* @param length | ||
* @returns | ||
*/ | ||
static alloc<N extends number>(length: N): Opaque<Bytes<N>>; | ||
/** | ||
* Bytes.tryAlloc | ||
* @param length | ||
* @returns | ||
*/ | ||
static tryAlloc<N extends number>(length: N): Result<Opaque<Bytes<N>>, BytesAllocError<N>>; | ||
/** | ||
* Bytes.allocUnsafe | ||
* @deprecated | ||
* @param length | ||
* @returns | ||
*/ | ||
static allocUnsafe<N extends number>(length: N): Opaque<Bytes<N>>; | ||
/** | ||
* Bytes.tryAllocUnsafe | ||
* @param length | ||
* @returns | ||
*/ | ||
static tryAllocUnsafe<N extends number>(length: N): Result<Opaque<Bytes<N>>, BytesAllocError<N>>; | ||
/** | ||
* Bytes.from | ||
* @deprecated | ||
* @param sized | ||
* @returns | ||
*/ | ||
static from<N extends number>(sized: Sized<number, N>): Opaque<Bytes<N>>; | ||
/** | ||
* Bytes.tryFrom | ||
* @param sized | ||
* @returns | ||
*/ | ||
static tryFrom<N extends number>(sized: Sized<number, N>): Result<Opaque<Bytes<N>>, BytesAllocError<N>>; | ||
/** | ||
* Bytes.random | ||
* @deprecated | ||
* @param length | ||
* @returns | ||
*/ | ||
static random<N extends number>(length: N): Opaque<Bytes<N>>; | ||
/** | ||
* Bytes.tryRandom | ||
* @param length | ||
* @returns | ||
*/ | ||
static tryRandom<N extends number>(length: N): Result<Opaque<Bytes<N>>, BytesAllocError<N>>; | ||
/** | ||
* Size this | ||
@@ -115,7 +52,7 @@ * @returns | ||
/** | ||
* Perform unsafe zero-copy conversion to `Opaque` if `T instanceof Opaque`, else use `Opaque.tryFrom` | ||
* Perform unsafe zero-copy conversion to `Opaque` if `T instanceof Opaque`, else use `Opaque.tryWriteFrom` | ||
* @param writable | ||
* @returns | ||
*/ | ||
function tryFrom<T extends Writable.Infer<T>>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | BinaryWriteError>; | ||
function tryWriteFrom<T extends Writable.Infer<T>>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | BinaryWriteError>; | ||
} | ||
@@ -133,9 +70,9 @@ /** | ||
/** | ||
* Perform safe, copy conversion to `Opaque` using `Opaque.tryFrom` | ||
* Perform safe copy conversion to `Opaque` if `T instanceof Opaque`, else use `Opaque.tryWriteFrom` | ||
* @param writable | ||
* @returns | ||
*/ | ||
function tryFrom<T extends Writable.Infer<T>>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | BinaryWriteError>; | ||
function tryWriteFrom<T extends Writable.Infer<T>>(writable: T): Result<Opaque, Writable.SizeError<T> | Writable.WriteError<T> | BinaryWriteError>; | ||
} | ||
export { Opaque, SafeOpaque, UnsafeOpaque }; |
{ | ||
"type": "module", | ||
"name": "@hazae41/binary", | ||
"version": "1.2.34", | ||
"version": "1.2.35", | ||
"description": "Zero-copy binary data types", | ||
@@ -25,15 +25,15 @@ "homepage": "https://github.com/hazae41/binary", | ||
"dependencies": { | ||
"@hazae41/bytes": "^1.1.21", | ||
"@hazae41/cursor": "^1.1.19", | ||
"@hazae41/result": "^1.0.46" | ||
"@hazae41/bytes": "^1.1.22", | ||
"@hazae41/cursor": "^1.1.24", | ||
"@hazae41/result": "^1.1.2" | ||
}, | ||
"devDependencies": { | ||
"@hazae41/phobos": "^1.0.10", | ||
"@rollup/plugin-typescript": "^11.1.1", | ||
"@types/node": "^20.3.1", | ||
"@rollup/plugin-typescript": "^11.1.3", | ||
"@types/node": "^20.5.7", | ||
"rimraf": "^5.0.1", | ||
"rollup": "^3.25.1", | ||
"rollup": "^3.28.1", | ||
"rollup-plugin-dts": "^5.3.0", | ||
"rollup-plugin-node-externals": "^6.1.1", | ||
"typescript": "^5.1.3" | ||
"typescript": "^5.2.2" | ||
}, | ||
@@ -40,0 +40,0 @@ "exports": { |
@@ -92,4 +92,4 @@ <div align="center"> | ||
const myobject = new MyObject(1, 515) | ||
const opaque = Opaque.tryFrom(myobject).unwrap() // Opaque(Uint8Array([1, 2, 3])) | ||
const opaque = Opaque.tryWriteFrom(myobject).unwrap() // Opaque(Uint8Array([1, 2, 3])) | ||
const bytes = Writable.tryWriteToBytes(opaque).unwrap() // Uint8Array([1, 2, 3]) | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53235
703
Updated@hazae41/bytes@^1.1.22
Updated@hazae41/cursor@^1.1.24
Updated@hazae41/result@^1.1.2