🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

ethereum-checksum-address

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethereum-checksum-address - npm Package Compare versions

Comparing version

to
0.0.3

16

index.js

@@ -8,3 +8,5 @@ const keccak256 = require('keccak256')

if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) { throw new Error(`Given address "${address}" is not a valid Ethereum address.`) }
if (!/^(0x)?[0-9a-f]{40}$/i.test(address)) {
throw new Error(`Given address "${address}" is not a valid Ethereum address.`)
}

@@ -18,3 +20,5 @@ const stripAddress = stripHexPrefix(address).toLowerCase()

for (let i = 0; i < stripAddress.length; i++) { checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i] }
for (let i = 0; i < stripAddress.length; i++) {
checksumAddress += parseInt(keccakHash[i], 16) >= 8 ? stripAddress[i].toUpperCase() : stripAddress[i]
}

@@ -38,7 +42,7 @@ return checksumAddress

return true
};
}
function stripHexPrefix (string) {
return string.slice(0, 2) === '0x' ? string.slice(2) : string
};
function stripHexPrefix (value) {
return value.slice(0, 2) === '0x' ? value.slice(2) : value
}

@@ -45,0 +49,0 @@ module.exports = {

{
"name": "ethereum-checksum-address",
"version": "0.0.2",
"version": "0.0.3",
"description": "Convert Ethereum address to a checksummed address",

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