Socket
Socket
Sign inDemoInstall

hex-encoding

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hex-encoding - npm Package Compare versions

Comparing version 2.0.0 to 2.0.2

11

dist/node.js
/* IMPORT */
import { Buffer } from 'node:buffer';
import Buffer from 'node-buffer-encoding';
import is from './is.js';

@@ -8,13 +8,12 @@ /* MAIN */

encode: (data) => {
return Buffer.from(data).toString('hex');
return Buffer.encode(data, 'hex');
},
encodeStr: (data) => {
return Buffer.from(data).toString('hex');
return Buffer.encodeStr(data, 'hex');
},
decode: (data) => {
const buffer = Buffer.from(data, 'hex');
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
return Buffer.decode(data, 'hex');
},
decodeStr: (data) => {
return Buffer.from(data, 'hex').toString();
return Buffer.decodeStr(data, 'hex');
},

@@ -21,0 +20,0 @@ is

@@ -5,3 +5,3 @@ {

"description": "Hex encoding. An extremely fast and synchronous JS implementation.",
"version": "2.0.0",
"version": "2.0.2",
"type": "module",

@@ -17,2 +17,3 @@ "main": "dist/node.js",

"benchmark:watch": "tsex benchmark --watch",
"benchmark:update": "wget https://www.gutenberg.org/cache/epub/2600/pg2600.txt -O tasks/fixture.txt",
"clean": "tsex clean",

@@ -23,3 +24,3 @@ "compile": "tsex compile",

"test:watch": "tsex test --watch",
"prepublishOnly": "npm run clean && npm run compile && npm run test"
"prepublishOnly": "tsex prepare"
},

@@ -33,12 +34,12 @@ "keywords": [

"dependencies": {
"node-buffer-encoding": "^1.0.1",
"uint8-encoding": "^2.0.0"
},
"devDependencies": {
"@types/node": "^17.0.23",
"benchloop": "^1.3.2",
"fast-check": "^2.24.0",
"fava": "^0.0.6",
"tsex": "^1.0.4",
"typescript": "^4.6.3"
"benchloop": "^2.0.0",
"fast-check": "^3.6.3",
"fava": "^0.2.0",
"tsex": "^2.2.0",
"typescript": "^4.9.5"
}
}
/* IMPORT */
import {Buffer} from 'node:buffer';
import Buffer from 'node-buffer-encoding';
import is from './is';

@@ -15,3 +15,3 @@

return Buffer.from ( data ).toString ( 'hex' );
return Buffer.encode ( data, 'hex' );

@@ -22,3 +22,3 @@ },

return Buffer.from ( data ).toString ( 'hex' );
return Buffer.encodeStr ( data, 'hex' );

@@ -29,6 +29,4 @@ },

const buffer = Buffer.from ( data, 'hex' );
return Buffer.decode ( data, 'hex' );
return new Uint8Array ( buffer.buffer, buffer.byteOffset, buffer.byteLength );
},

@@ -38,3 +36,3 @@

return Buffer.from ( data, 'hex' ).toString ();
return Buffer.decodeStr ( data, 'hex' );

@@ -41,0 +39,0 @@ },

@@ -9,3 +9,5 @@

const WAP = fs.readFileSync ( './tasks/war_and_peace.txt', 'utf8' );
/* HELPERS */
const WAP = fs.readFileSync ( './tasks/fixture.txt', 'utf8' );
const WAP_UINT8 = U8.encode ( WAP );

@@ -18,4 +20,3 @@ const WAP_ENCODED = Hex.encodeStr ( WAP );

benchmark.defaultOptions = Object.assign ( benchmark.defaultOptions, {
iterations: 1,
log: 'compact'
iterations: 1
});

@@ -22,0 +23,0 @@

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