Comparing version 2.1.4-next.ca84dcc.0 to 2.1.4-next.ce05b65
@@ -1,2 +0,1 @@ | ||
/// <reference lib="dom" /> | ||
interface OnUnsupported { | ||
@@ -50,3 +49,2 @@ (value: unknown): unknown; | ||
/// <reference lib="dom" /> | ||
declare class Deserializer { | ||
@@ -167,3 +165,5 @@ offset: number; | ||
declare namespace TypedArrays { | ||
const constructors: (new <T extends TypedArray>(...args: any) => T)[]; | ||
const constructors: { | ||
new <T extends TypedArray>(...args: any): T; | ||
}[]; | ||
const typedArrayTags: Map<string, BinaryTokens>; | ||
@@ -180,2 +180,2 @@ const typedArrayTagToConstructor: Map<BinaryTokens, new <T extends TypedArray>(...args: any) => T>; | ||
export { BigIntegers, BinaryPrimitives, BinaryTokens, Deserializer, DeserializerError, DeserializerReason, Numbers, OnUnsupported, RegExps, Serializer, SerializerError, SerializerReason, TypedArray, TypedArrays, deserialize, deserializeWithMetadata, serialize }; | ||
export { BigIntegers, BinaryPrimitives, BinaryTokens, Deserializer, DeserializerError, DeserializerReason, Numbers, type OnUnsupported, RegExps, Serializer, SerializerError, SerializerReason, TypedArray, TypedArrays, deserialize, deserializeWithMetadata, serialize }; |
@@ -130,14 +130,8 @@ "use strict"; | ||
let ret = ""; | ||
if (integer & g) | ||
ret += "g"; | ||
if (integer & i) | ||
ret += "i"; | ||
if (integer & m) | ||
ret += "m"; | ||
if (integer & y) | ||
ret += "y"; | ||
if (integer & u) | ||
ret += "u"; | ||
if (integer & s) | ||
ret += "s"; | ||
if (integer & g) ret += "g"; | ||
if (integer & i) ret += "i"; | ||
if (integer & m) ret += "m"; | ||
if (integer & y) ret += "y"; | ||
if (integer & u) ret += "u"; | ||
if (integer & s) ret += "s"; | ||
return ret; | ||
@@ -178,6 +172,4 @@ } | ||
]; | ||
if (typeof BigInt64Array === "function") | ||
TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") | ||
TypedArrays2.constructors.push(BigUint64Array); | ||
if (typeof BigInt64Array === "function") TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") TypedArrays2.constructors.push(BigUint64Array); | ||
TypedArrays2.typedArrayTags = new Map( | ||
@@ -540,10 +532,7 @@ TypedArrays2.constructors.map( | ||
parseObject(value) { | ||
if (value === null) | ||
return this.parseValueNull(); | ||
if (value === null) return this.parseValueNull(); | ||
const id = this._objectIDs.get(value); | ||
if (typeof id === "number") | ||
return this.parseValueReference(id); | ||
if (typeof id === "number") return this.parseValueReference(id); | ||
this._objectIDs.set(value, this._objectIDs.size); | ||
if (Array.isArray(value)) | ||
return this.parseValueArray(value); | ||
if (Array.isArray(value)) return this.parseValueArray(value); | ||
const tag = Object.prototype.toString.call(value); | ||
@@ -657,6 +646,4 @@ switch (tag) { | ||
const typedArrayTag = TypedArrays.typedArrayTags.get(tag); | ||
if (typedArrayTag) | ||
this.writeValueTypedArray(value, typedArrayTag); | ||
else | ||
this.parseValueObjectLiteral(value); | ||
if (typedArrayTag) this.writeValueTypedArray(value, typedArrayTag); | ||
else this.parseValueObjectLiteral(value); | ||
} | ||
@@ -728,6 +715,4 @@ parseValueReference(value) { | ||
if (value % 1 === 0) { | ||
if (value >= MIN_INT8 && value <= MAX_INT8) | ||
return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) | ||
return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
if (value >= MIN_INT8 && value <= MAX_INT8) return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
} | ||
@@ -758,4 +743,3 @@ return sign ? 13 /* SignedFloat64 */ : 12 /* UnsignedFloat64 */; | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -768,4 +752,3 @@ deserializer.clean(); | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -772,0 +755,0 @@ const bufferOffset = deserializer.offset; |
@@ -130,14 +130,8 @@ "use strict"; | ||
let ret = ""; | ||
if (integer & g) | ||
ret += "g"; | ||
if (integer & i) | ||
ret += "i"; | ||
if (integer & m) | ||
ret += "m"; | ||
if (integer & y) | ||
ret += "y"; | ||
if (integer & u) | ||
ret += "u"; | ||
if (integer & s) | ||
ret += "s"; | ||
if (integer & g) ret += "g"; | ||
if (integer & i) ret += "i"; | ||
if (integer & m) ret += "m"; | ||
if (integer & y) ret += "y"; | ||
if (integer & u) ret += "u"; | ||
if (integer & s) ret += "s"; | ||
return ret; | ||
@@ -178,6 +172,4 @@ } | ||
]; | ||
if (typeof BigInt64Array === "function") | ||
TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") | ||
TypedArrays2.constructors.push(BigUint64Array); | ||
if (typeof BigInt64Array === "function") TypedArrays2.constructors.push(BigInt64Array); | ||
if (typeof BigUint64Array === "function") TypedArrays2.constructors.push(BigUint64Array); | ||
TypedArrays2.typedArrayTags = new Map( | ||
@@ -540,10 +532,7 @@ TypedArrays2.constructors.map( | ||
parseObject(value) { | ||
if (value === null) | ||
return this.parseValueNull(); | ||
if (value === null) return this.parseValueNull(); | ||
const id = this._objectIDs.get(value); | ||
if (typeof id === "number") | ||
return this.parseValueReference(id); | ||
if (typeof id === "number") return this.parseValueReference(id); | ||
this._objectIDs.set(value, this._objectIDs.size); | ||
if (Array.isArray(value)) | ||
return this.parseValueArray(value); | ||
if (Array.isArray(value)) return this.parseValueArray(value); | ||
const tag = Object.prototype.toString.call(value); | ||
@@ -657,6 +646,4 @@ switch (tag) { | ||
const typedArrayTag = TypedArrays.typedArrayTags.get(tag); | ||
if (typedArrayTag) | ||
this.writeValueTypedArray(value, typedArrayTag); | ||
else | ||
this.parseValueObjectLiteral(value); | ||
if (typedArrayTag) this.writeValueTypedArray(value, typedArrayTag); | ||
else this.parseValueObjectLiteral(value); | ||
} | ||
@@ -728,6 +715,4 @@ parseValueReference(value) { | ||
if (value % 1 === 0) { | ||
if (value >= MIN_INT8 && value <= MAX_INT8) | ||
return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) | ||
return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
if (value >= MIN_INT8 && value <= MAX_INT8) return sign ? 9 /* SignedByte */ : 8 /* UnsignedByte */; | ||
if (value >= MIN_INT32 && value <= MAX_INT32) return sign ? 11 /* SignedInt32 */ : 10 /* UnsignedInt32 */; | ||
} | ||
@@ -758,4 +743,3 @@ return sign ? 13 /* SignedFloat64 */ : 12 /* UnsignedFloat64 */; | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -768,4 +752,3 @@ deserializer.clean(); | ||
const deserializer = new Deserializer(buffer); | ||
if (offset !== -1) | ||
deserializer.offset = offset; | ||
if (offset !== -1) deserializer.offset = offset; | ||
const value = deserializer.read(); | ||
@@ -772,0 +755,0 @@ const bufferOffset = deserializer.offset; |
{ | ||
"name": "binarytf", | ||
"version": "2.1.4-next.ca84dcc.0", | ||
"version": "2.1.4-next.ce05b65", | ||
"description": "Binary Term Format", | ||
@@ -29,29 +29,25 @@ "author": "kyranet <kyradiscord@gmail.com>", | ||
"check-update": "cliff-jumper --dry-run", | ||
"_postinstall": "husky install .github/husky", | ||
"prepack": "yarn build && pinst --disable", | ||
"postpack": "pinst --enable" | ||
"prepack": "yarn build" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "^17.7.2", | ||
"@commitlint/config-conventional": "^17.7.0", | ||
"@favware/cliff-jumper": "^2.2.0", | ||
"@sapphire/eslint-config": "^5.0.2", | ||
"@commitlint/cli": "^19.6.0", | ||
"@commitlint/config-conventional": "^19.6.0", | ||
"@favware/cliff-jumper": "^5.0.0", | ||
"@sapphire/eslint-config": "^5.0.5", | ||
"@sapphire/prettier-config": "^2.0.0", | ||
"@sapphire/ts-config": "^5.0.0", | ||
"@types/node": "^20.8.0", | ||
"@typescript-eslint/eslint-plugin": "^6.7.3", | ||
"@typescript-eslint/parser": "^6.7.3", | ||
"@vitest/coverage-v8": "^0.34.6", | ||
"@sapphire/ts-config": "^5.0.1", | ||
"@types/node": "^20.11.5", | ||
"@typescript-eslint/eslint-plugin": "^7.13.1", | ||
"@typescript-eslint/parser": "^7.13.1", | ||
"@vitest/coverage-v8": "^2.1.6", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.50.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.0", | ||
"husky": "^8.0.3", | ||
"lint-staged": "^14.0.1", | ||
"pinst": "^3.0.0", | ||
"prettier": "^3.0.3", | ||
"tsup": "^7.2.0", | ||
"typedoc": "^0.25.0", | ||
"typescript": "^5.2.2", | ||
"vitest": "^0.34.6" | ||
"eslint": "^8.57.1", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.2.1", | ||
"lint-staged": "^15.2.10", | ||
"prettier": "^3.4.1", | ||
"tsup": "^8.3.5", | ||
"typedoc": "^0.26.1", | ||
"typescript": "^5.5.2", | ||
"vitest": "^2.1.6" | ||
}, | ||
@@ -102,3 +98,3 @@ "repository": { | ||
"prettier": "@sapphire/prettier-config", | ||
"packageManager": "yarn@3.6.3" | ||
"packageManager": "yarn@4.5.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
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
20
221604
2413