reason-uuid
v1.0.0
Published
BuckleScript bindings for node-uuid
Downloads
411
Maintainers
Readme
reason-uuid
Bucklescript bindings for node-uuid.
Installation
npm install reason-uuid --save
Then add "reason-uuid"
to the the bs-dependencies
section of your bsconfig.json
.
Usage
Version 1 (timestamp)
let uuid = Uuid.V1.make();
Version 3 (namespace)
/* Using predefined DNS namespace */
let uuid = Uuid.V3.make("hello.example.com", Uuid.Dns);
/* Using predefined URL namespace */
let uuid = Uuid.V3.make("http://example.com/hello", Uuid.Url);
/* Using a custom namespace */
let uuid = Uuid.V3.make("Hello, world!", Uuid.Custom("1b671a64-40d5-491e-99b0-da01ff1f3341"));
Version 4 (random)
let uuidv4 = Uuid.V4.make();
or
let uuidv4 = Uuid.make();
Version 5 (namespace)
/* Using predefined DNS namespace */
let uuidv5_1 = Uuid.V5.make("hello.example.com", Uuid.DNS);
/* Using predefined URL namespace */
let uuidv5_2 = Uuid.V5.make("http://example.com/hello", Uuid.URL);
/* Using a custom namespace */
let namespace = "1b671a64-40d5-491e-99b0-da01ff1f3341";
let uuidv5_3 = Uuid.V5.make("Hello, world!", Uuid.Custom(namespace)));