New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@dao-xyz/borsh

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dao-xyz/borsh - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

12

lib/cjs/bigint.d.ts

@@ -1,14 +0,2 @@

/**
* Convert a little - endian buffer into a BigInt.
* This function will modify the buf (dont use it afterwards)
* @param buf The little - endian buffer to convert
* @returns A BigInt with the little - endian representation of buf.
*/
export declare function toBigIntLE(buf: Uint8Array): bigint;
/**
* Convert a BigInt to a little-endian buffer.
* @param num The BigInt to convert.
* @param width The number of bytes that the resulting buffer should be.
* @returns A little-endian buffer representation of num.
*/
export declare function toBufferLE(num: bigint, width: number): Uint8Array;

@@ -9,8 +9,2 @@ "use strict";

}
/**
* Convert a little - endian buffer into a BigInt.
* This function will modify the buf (dont use it afterwards)
* @param buf The little - endian buffer to convert
* @returns A BigInt with the little - endian representation of buf.
*/
function toBigIntLE(buf) {

@@ -25,8 +19,2 @@ const reversed = buf.reverse();

exports.toBigIntLE = toBigIntLE;
/**
* Convert a BigInt to a little-endian buffer.
* @param num The BigInt to convert.
* @param width The number of bytes that the resulting buffer should be.
* @returns A little-endian buffer representation of num.
*/
function toBufferLE(num, width) {

@@ -33,0 +21,0 @@ const hex = num.toString(16);

2

lib/cjs/binary.js

@@ -57,3 +57,3 @@ "use strict";

this.maybeResize();
this.buf.setUint8(value ? 1 : 0, this.length);
this.buf.setUint8(this.length, value ? 1 : 0);
this.length += 1;

@@ -60,0 +60,0 @@ }

@@ -1,14 +0,2 @@

/**
* Convert a little - endian buffer into a BigInt.
* This function will modify the buf (dont use it afterwards)
* @param buf The little - endian buffer to convert
* @returns A BigInt with the little - endian representation of buf.
*/
export declare function toBigIntLE(buf: Uint8Array): bigint;
/**
* Convert a BigInt to a little-endian buffer.
* @param num The BigInt to convert.
* @param width The number of bytes that the resulting buffer should be.
* @returns A little-endian buffer representation of num.
*/
export declare function toBufferLE(num: bigint, width: number): Uint8Array;
{
"name": "@dao-xyz/borsh",
"version": "3.2.0",
"version": "3.2.1",
"readme": "README.md",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/dao-xyz/borsh-ts#README",

@@ -35,2 +35,3 @@ # Borsh TS

vec,
option
} from "@dao-xyz/borsh";

@@ -37,0 +38,0 @@

@@ -937,2 +937,29 @@ import { BinaryReader } from "../binary";

describe("bool", () => {
test("field bolean", () => {
class TestStruct {
@field({ type: "bool" })
public a: boolean;
constructor(a: boolean) {
this.a = a;
}
}
validate(TestStruct);
const expectedResult: StructKind = new StructKind({
fields: [
{
key: "a",
type: "bool",
},
],
});
expect(getSchema(TestStruct)).toEqual(expectedResult);
const bufSome = serialize(new TestStruct(true));
expect(bufSome).toEqual(new Uint8Array([1]));
const deserializedSome = deserialize(new Uint8Array(bufSome), TestStruct);
expect(deserializedSome.a).toEqual(true);
});
});
describe("override", () => {

@@ -939,0 +966,0 @@ test("serialize/deserialize", () => {

@@ -7,8 +7,2 @@ function arrayToHex(arr: Uint8Array): string {

/**
* Convert a little - endian buffer into a BigInt.
* This function will modify the buf (dont use it afterwards)
* @param buf The little - endian buffer to convert
* @returns A BigInt with the little - endian representation of buf.
*/
export function toBigIntLE(buf: Uint8Array): bigint {

@@ -22,8 +16,3 @@ const reversed = buf.reverse();

}
/**
* Convert a BigInt to a little-endian buffer.
* @param num The BigInt to convert.
* @param width The number of bytes that the resulting buffer should be.
* @returns A little-endian buffer representation of num.
*/
export function toBufferLE(num: bigint, width: number): Uint8Array {

@@ -30,0 +19,0 @@ const hex = num.toString(16);

@@ -35,3 +35,3 @@ const INITIAL_LENGTH = 1024;

this.maybeResize();
this.buf.setUint8(value ? 1 : 0, this.length);
this.buf.setUint8(this.length, value ? 1 : 0);
this.length += 1;

@@ -38,0 +38,0 @@ }

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc