New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

uuid25

Package Overview
Dependencies
Maintainers
0
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uuid25

25-digit case-insensitive UUID encoding

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
519
decreased by-14.21%
Maintainers
0
Weekly downloads
 
Created
Source

Uuid25: 25-digit case-insensitive UUID encoding

npm License

Uuid25 is an alternative UUID representation that shortens a UUID string to just 25 digits using the case-insensitive Base36 encoding. This library provides functionality to convert from the conventional UUID formats to Uuid25 and vice versa.

import { Uuid25 } from "uuid25";

// convert from/to string
const a = Uuid25.parse("8da942a4-1fbe-4ca6-852c-95c473229c7d");
console.assert(a.value === "8dx554y5rzerz1syhqsvsdw8t");
console.assert(a.toHyphenated() === "8da942a4-1fbe-4ca6-852c-95c473229c7d");

// convert from/to 128-bit byte array
const b = Uuid25.fromBytes(new Uint8Array(16).fill(0xff));
console.assert(b.value === "f5lxx1zz5pnorynqglhzmsp33");
console.assert(b.toBytes().every((x) => x === 0xff));

// convert from/to other popular textual representations
const c = [
  Uuid25.parse("e7a1d63b711744238988afcf12161878"),
  Uuid25.parse("e7a1d63b-7117-4423-8988-afcf12161878"),
  Uuid25.parse("{e7a1d63b-7117-4423-8988-afcf12161878}"),
  Uuid25.parse("urn:uuid:e7a1d63b-7117-4423-8988-afcf12161878"),
];
console.assert(c.every((x) => x.value === "dpoadk8izg9y4tte7vy1xt94o"));

const d = Uuid25.parse("dpoadk8izg9y4tte7vy1xt94o");
console.assert(d.toHex() === "e7a1d63b711744238988afcf12161878");
console.assert(d.toHyphenated() === "e7a1d63b-7117-4423-8988-afcf12161878");
console.assert(d.toBraced() === "{e7a1d63b-7117-4423-8988-afcf12161878}");
console.assert(d.toUrn() === "urn:uuid:e7a1d63b-7117-4423-8988-afcf12161878");

CommonJS support

The CommonJS entry point is deprecated and provided for backward compatibility purposes only. The entry point is no longer tested and will be removed in the future.

License

Licensed under the Apache License, Version 2.0.

See also

Keywords

FAQs

Package last updated on 20 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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