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

@thi.ng/hex

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/hex - npm Package Compare versions

Comparing version 0.1.3 to 0.2.0

11

CHANGELOG.md

@@ -6,18 +6,13 @@ # Change Log

## [0.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/hex@0.1.2...@thi.ng/hex@0.1.3) (2021-01-02)
# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hex@0.1.3...@thi.ng/hex@0.2.0) (2021-02-20)
**Note:** Version bump only for package @thi.ng/hex
### Features
* **hex:** add uuid() ([c8417b4](https://github.com/thi-ng/umbrella/commit/c8417b4c2fe3eeb664b4131aabe592d612573703))
## [0.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/hex@0.1.1...@thi.ng/hex@0.1.2) (2020-12-22)
**Note:** Version bump only for package @thi.ng/hex
# 0.1.0 (2020-11-24)

@@ -24,0 +19,0 @@

@@ -153,2 +153,10 @@ /**

export declare const U64LE: (x: ArrayLike<number>, i: number) => string;
/**
* Returns UUID formatted string of given byte array from optional start index
* `i` (default: 0). Array must have min. length 16 (starting from `i`).
*
* @param id -
* @param i -
*/
export declare const uuid: (id: ArrayLike<number>, i?: number) => string;
//# sourceMappingURL=index.d.ts.map

@@ -154,1 +154,11 @@ const P32 = 0x100000000;

export const U64LE = (x, i) => U32LE(x, i + 4) + U32LE(x, i);
/**
* Returns UUID formatted string of given byte array from optional start index
* `i` (default: 0). Array must have min. length 16 (starting from `i`).
*
* @param id -
* @param i -
*/
export const uuid = (id, i = 0) =>
// prettier-ignore
`${U32BE(id, i)}-${U16BE(id, i + 4)}-${U16BE(id, i + 6)}-${U16BE(id, i + 8)}-${U48BE(id, i + 10)}`;

@@ -27,2 +27,4 @@ 'use strict';

const U64LE = (x, i) => U32LE(x, i + 4) + U32LE(x, i);
const uuid = (id, i = 0) =>
`${U32BE(id, i)}-${U16BE(id, i + 4)}-${U16BE(id, i + 6)}-${U16BE(id, i + 8)}-${U48BE(id, i + 10)}`;

@@ -50,1 +52,2 @@ exports.HEX = HEX;

exports.U8A = U8A;
exports.uuid = uuid;

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.hex={}))}(this,(function(e){"use strict";const t=4294967296,U="0123456789abcdef",i=e=>U[e>>>4&15]+U[15&e],n=e=>i(e>>>8)+i(255&e),o=(e,t)=>i(e[t])+i(e[t+1]),f=(e,t)=>i(e[t+1])+i(e[t]),d=e=>n(e>>>16)+n(e),s=(e,t)=>o(e,t)+o(e,t+2),E=(e,t)=>f(e,t+2)+f(e,t),h=(e,t)=>n(e)+d(t),u=(e,t)=>d(e)+d(t);e.HEX=U,e.U16=n,e.U16BE=o,e.U16LE=f,e.U24=e=>i(e>>>16)+n(e),e.U24BE=(e,t)=>i(e[t])+o(e,t+1),e.U24LE=(e,t)=>i(e[t+2])+f(e,t),e.U32=d,e.U32BE=s,e.U32LE=E,e.U4=e=>U[15&e],e.U48=e=>h(e/t,e%t),e.U48BE=(e,t)=>o(e,t)+s(e,t+2),e.U48HL=h,e.U48LE=(e,t)=>f(e,t+4)+E(e,t),e.U64=e=>u(e/t,e%t),e.U64BE=(e,t)=>s(e,t)+s(e,t+4),e.U64HL=u,e.U64LE=(e,t)=>E(e,t+4)+E(e,t),e.U8=i,e.U8A=(e,t)=>i(e[t]),Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.hex={}))}(this,(function(e){"use strict";const t=4294967296,U="0123456789abcdef",i=e=>U[e>>>4&15]+U[15&e],n=e=>i(e>>>8)+i(255&e),o=(e,t)=>i(e[t])+i(e[t+1]),f=(e,t)=>i(e[t+1])+i(e[t]),d=e=>n(e>>>16)+n(e),s=(e,t)=>o(e,t)+o(e,t+2),u=(e,t)=>f(e,t+2)+f(e,t),E=(e,t)=>n(e)+d(t),h=(e,t)=>o(e,t)+s(e,t+2),c=(e,t)=>d(e)+d(t);e.HEX=U,e.U16=n,e.U16BE=o,e.U16LE=f,e.U24=e=>i(e>>>16)+n(e),e.U24BE=(e,t)=>i(e[t])+o(e,t+1),e.U24LE=(e,t)=>i(e[t+2])+f(e,t),e.U32=d,e.U32BE=s,e.U32LE=u,e.U4=e=>U[15&e],e.U48=e=>E(e/t,e%t),e.U48BE=h,e.U48HL=E,e.U48LE=(e,t)=>f(e,t+4)+u(e,t),e.U64=e=>c(e/t,e%t),e.U64BE=(e,t)=>s(e,t)+s(e,t+4),e.U64HL=c,e.U64LE=(e,t)=>u(e,t+4)+u(e,t),e.U8=i,e.U8A=(e,t)=>i(e[t]),e.uuid=(e,t=0)=>`${s(e,t)}-${o(e,t+4)}-${o(e,t+6)}-${o(e,t+8)}-${h(e,t+10)}`,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@thi.ng/hex",
"version": "0.1.3",
"version": "0.2.0",
"description": "Hex string formatters for 4/8/16/24/32/48/64bit words",

@@ -45,7 +45,7 @@ "module": "./index.js",

"@types/node": "^14.14.14",
"mocha": "^8.2.1",
"mocha": "^8.3.0",
"nyc": "^15.1.0",
"ts-node": "^9.1.1",
"typedoc": "^0.20.4",
"typescript": "^4.1.3"
"typedoc": "^0.20.26",
"typescript": "^4.1.5"
},

@@ -72,3 +72,3 @@ "files": [

},
"gitHead": "a2127bae6d16682027fd94190452b8404bf99a47"
"gitHead": "2cb9a54255d6a5d7f21c9875002b86c42dd038de"
}

@@ -44,3 +44,3 @@ <!-- This file is generated - DO NOT EDIT! -->

Package sizes (gzipped, pre-treeshake): ESM: 322 bytes / CJS: 428 bytes / UMD: 491 bytes
Package sizes (gzipped, pre-treeshake): ESM: 358 bytes / CJS: 469 bytes / UMD: 525 bytes

@@ -47,0 +47,0 @@ ## Dependencies

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