@somosphi/uuid
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

@somosphi/uuid

Utility functions for dealing with UUIDs.

Installation

$ npm install @somosphi/uuid

Quick start

Using Node:

const Uuid = require('@somosphi/uuid');

Using Typescript:

import * as Uuid from '@somosphi/uuid';

Generating a random UUID (version 4)

const id = Uuid.generate();
console.log(id);
// => '28d53a31-8f6f-4939-a51e-d7dc0f81585f'

Converting a UUID in string format to binary

const binaryId = Uuid.stringToBinary(id);
console.log(binaryId);
// => <Buffer 28 d5 3a 31 8f 6f 49 39 a5 1e d7 dc 0f 81 58 5f>

Converting a UUID in binary format to a string

const stringId = Uuid.binaryToString(binaryId);
console.log(stringId);
// => '28d53a31-8f6f-4939-a51e-d7dc0f81585f'

Package Sidebar

Install

npm i @somosphi/uuid

Weekly Downloads

89

Version

1.0.0

License

MIT

Unpacked Size

5.08 kB

Total Files

6

Last publish

Collaborators

  • henrique502