🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@exodus/bytes

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exodus/bytes - npm Package Compare versions

Comparing version
1.15.0
to
1.15.1
+1
-1
assert.js

@@ -11,3 +11,3 @@ export function assertEmptyRest(rest) {

export function assertTypedArray(arr) {
if (arr instanceof TypedArray) return
if (arr && arr instanceof TypedArray) return
throw new TypeError('Expected a TypedArray instance')

@@ -14,0 +14,0 @@ }

@@ -165,3 +165,3 @@ import { assertU8, fromUint8, E_STRING } from './fallback/_utils.js'

let y = Number(x & _0xffffffffn)
x >>= 32n
x >>= _32n
res[--at] = y & 0xff

@@ -168,0 +168,0 @@ y >>>= 8

@@ -77,2 +77,3 @@ import { assertEmptyRest } from './assert.js'

export function fromBase64any(str, { format = 'uint8', padding = 'both', ...rest } = {}) {
if (typeof str !== 'string') throw new TypeError(E_STRING)
const isBase64url = !str.includes('+') && !str.includes('/') // likely to fail fast, as most input is non-url, also double scan is faster than regex

@@ -79,0 +80,0 @@ return fromBase64common(str, isBase64url, padding, format, rest)

@@ -10,3 +10,4 @@ export * from './platform.js'

export function assertU8(arg) {
if (!(arg instanceof Uint8Array)) throw new TypeError('Expected an Uint8Array')
if (arg && arg instanceof Uint8Array) return
throw new TypeError('Expected an Uint8Array')
}

@@ -51,3 +52,5 @@

case 'arraybuffer':
return fromBuffer(arr, 'uint8').buffer
return arr.buffer.byteLength === arr.byteLength
? arr.buffer
: arr.buffer.slice(arr.byteOffset, arr.byteOffset + arr.byteLength)
case 'buffer':

@@ -54,0 +57,0 @@ if (arr.constructor !== Buffer) throw new Error('Unexpected')

@@ -76,3 +76,3 @@ import { E_STRING } from './_utils.js'

const codes = encodeAscii(str, E_HEX)
const codes = encodeAscii(str, E_HEX) // aligned
const codes16 = new Uint16Array(codes.buffer, codes.byteOffset, codes.byteLength / 2)

@@ -79,0 +79,0 @@ let i = 0

@@ -143,2 +143,3 @@ import {

// TextEncoder is slow on Node.js 24 / 25 (was ok on 22)
// Node.js Buffer.from always returns 8-byte aligned allocations, this is safe for e.g. conversion to Uint32Array
const codes = nativeBuffer.from(str, 'utf8') // ascii/latin1 coerces, we need to check

@@ -145,0 +146,0 @@ if (codes.length !== str.length) throw new SyntaxError(ERR) // non-ascii

{
"name": "@exodus/bytes",
"version": "1.15.0",
"version": "1.15.1",
"description": "Various operations on Uint8Array data",

@@ -5,0 +5,0 @@ "keywords": [