Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chia-changelist-generator

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chia-changelist-generator - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

29

index.js

@@ -23,5 +23,8 @@ const Datalayer = require("chia-datalayer");

const isValidHexadecimal = (value) => {
const isValidHexadecimal = (value) => {
if (value?.startsWith("0x")) {
value = value.slice(2);
}
const hexRegex = /^[0-9a-fA-F]+$/;
return hexRegex.test(value);
return hexRegex.test(value?.trim());
};

@@ -34,5 +37,5 @@

if (!isValidHexadecimal(value)) {
if (action == 'insert' && !isValidHexadecimal(value)) {
throw new Error(
`Value for ${decodeHex(key)} is not a valid hexadecimal string`
`Value for ${key} is not a valid hexadecimal string`
);

@@ -55,3 +58,6 @@ }

if (existingKeys.includes(`0x${key}`)) {
const hexKey = key.startsWith("0x") ? key : "0x" + key;
if (existingKeys.includes(hexKey)) {
console.log(`UPDATE: Key ${decodeHex(key)}`);
change.push({

@@ -61,2 +67,4 @@ action: "delete",

});
} else {
console.log(`INSERT: Key ${decodeHex(key)}`);
}

@@ -76,3 +84,8 @@

if (existingKeys.includes(`0x${key}`)) {
const hexKey = key.startsWith("0x") ? key : "0x" + key;
if (existingKeys.includes(hexKey)) {
console.log(
`DELETE: Key ${decodeHex(key)} exists in store adding to change list`
);
change.push({

@@ -82,2 +95,6 @@ action: "delete",

});
} else {
console.warn(
`Key ${decodeHex(key)} does not exist in store not adding to change list`
);
}

@@ -84,0 +101,0 @@

{
"name": "chia-changelist-generator",
"version": "1.0.4",
"version": "1.0.5",
"description": "Easily Generate a ChangeList for Chia DataLayer",

@@ -5,0 +5,0 @@ "main": "index.js",

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