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

@xylabs/hex

Package Overview
Dependencies
Maintainers
5
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/hex - npm Package Compare versions

Comparing version 3.6.7 to 3.6.8

6

package.json

@@ -42,4 +42,4 @@ {

"devDependencies": {
"@xylabs/ts-scripts-yarn3": "^3.15.4",
"@xylabs/tsconfig": "^3.15.4",
"@xylabs/ts-scripts-yarn3": "^3.15.5",
"@xylabs/tsconfig": "^3.15.5",
"tslib": "^2.6.3",

@@ -59,4 +59,4 @@ "typescript": "^5.5.4"

"sideEffects": false,
"version": "3.6.7",
"version": "3.6.8",
"type": "module"
}

@@ -7,6 +7,8 @@ export type AssertCallback = (value: unknown, message: string) => string | boolean

if (assert) {
const assertString =
typeof assert === 'string' ? assert
: typeof assert === 'boolean' ? defaultMessage
: assert(value, defaultMessage)
const assertString
= typeof assert === 'string'
? assert
: typeof assert === 'boolean'
? defaultMessage
: assert(value, defaultMessage)
if (assertString) {

@@ -13,0 +15,0 @@ throw new Error(assertString === true ? defaultMessage : assertString)

@@ -11,4 +11,4 @@ import { Hex, HexConfig } from '../model.ts'

): Hex => {
const unPadded = [...new Uint8Array(buffer)].map((x) => x.toString(16).padStart(2, '0')).join('')
const unPadded = [...new Uint8Array(buffer)].map(x => x.toString(16).padStart(2, '0')).join('')
return hexFromHexString(unPadded, config)
}

@@ -6,3 +6,3 @@ import { Hex, HexConfig } from './model.ts'

export const isHex = (value: unknown, config?: HexConfig): value is Hex => {
//Is it a string?
// Is it a string?
if (typeof value !== 'string') return false

@@ -12,7 +12,7 @@

//If a bitLength specified, does it conform?
// If a bitLength specified, does it conform?
if (config?.bitLength !== undefined && valueCharLength !== bitsToNibbles(config?.bitLength)) return false
//Does it only has hex values?
// Does it only has hex values?
return config?.prefix ? hexRegexWithPrefix.test(value) : hexRegex.test(value)
}
export const toHexLegacy = (buffer: ArrayBuffer) => {
return [...new Uint8Array(buffer)].map((x) => x.toString(16).padStart(2, '0')).join('')
return [...new Uint8Array(buffer)].map(x => x.toString(16).padStart(2, '0')).join('')
}

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

//we use Exclude to intentionally make the type not equal to string
// we use Exclude to intentionally make the type not equal to string
export type Hex = Exclude<Lowercase<string>, 'reserved-hex-value'>

@@ -3,0 +3,0 @@

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

//determine the number of nibbles for a given number of bits
// determine the number of nibbles for a given number of bits
export const bitsToNibbles = (value: number): number => {

@@ -8,5 +8,5 @@ const nibbles = value >> 2

//determine the number of nibbles for a given number of bits
// determine the number of nibbles for a given number of bits
export const nibblesToBits = (value: number): number => {
return value << 2
}

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

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

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