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

@mysten/bcs

Package Overview
Dependencies
Maintainers
0
Versions
525
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mysten/bcs - npm Package Compare versions

Comparing version 0.0.0-experimental-20241126214925 to 0.0.0-experimental-20241209193009

8

CHANGELOG.md
# Change Log
## 0.0.0-experimental-20241126214925
## 0.0.0-experimental-20241209193009
### Minor Changes
- ad24b95: Verify hex string is valid hex in `fromHex`
## 1.1.1
### Patch Changes

@@ -6,0 +12,0 @@

7

dist/cjs/hex.js

@@ -29,4 +29,7 @@ "use strict";

const normalized = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}}`;
const intArr = padded.match(/.{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}`;
const intArr = padded.match(/[0-9a-fA-F]{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
if (intArr.length !== padded.length / 2) {
throw new Error(`Invalid hex string ${hexStr}`);
}
return Uint8Array.from(intArr);

@@ -33,0 +36,0 @@ }

function fromHex(hexStr) {
const normalized = hexStr.startsWith("0x") ? hexStr.slice(2) : hexStr;
const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}}`;
const intArr = padded.match(/.{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}`;
const intArr = padded.match(/[0-9a-fA-F]{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
if (intArr.length !== padded.length / 2) {
throw new Error(`Invalid hex string ${hexStr}`);
}
return Uint8Array.from(intArr);

@@ -6,0 +9,0 @@ }

{
"name": "@mysten/bcs",
"version": "0.0.0-experimental-20241126214925",
"version": "0.0.0-experimental-20241209193009",
"description": "BCS - Canonical Binary Serialization implementation for JavaScript",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

@@ -6,5 +6,9 @@ // Copyright (c) Mysten Labs, Inc.

const normalized = hexStr.startsWith('0x') ? hexStr.slice(2) : hexStr;
const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}}`;
const intArr = padded.match(/.{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
const padded = normalized.length % 2 === 0 ? normalized : `0${normalized}`;
const intArr = padded.match(/[0-9a-fA-F]{2}/g)?.map((byte) => parseInt(byte, 16)) ?? [];
if (intArr.length !== padded.length / 2) {
throw new Error(`Invalid hex string ${hexStr}`);
}
return Uint8Array.from(intArr);

@@ -11,0 +15,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

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