6
39%
Unlicense
bs-guid
1.0.1
BuckleScript bindings for node-uuid

bs-guid

Simple, fast generation of RFC4122 UUIDs for Reason.

NPM Version Conventional Commits

bs-guid is a statically typed interface to node-uuid.

Installation

yarn add bs-guid

In your bsconfig.json, include "bs-guid" in the bs-dependencies.

Usage

Version 1 (timestamp)

  • RE
  • ML
let uuidv1 = Uuid.V1.uuidv1();
let uuidv1 = Uuid.V1.uuidv1 ()

Version 3 (namespace)

  • RE
  • ML
/* ...using predefined DNS namespace */
let uuidv3_1 = Uuid.V3.uuidv3("hello.example.com", Uuid.DNS);

/* ...using predefined URL namespace */
let uuidv3_2 = Uuid.V3.uuidv3("http://example.com/hello", Uuid.URL);

/* ...using a custom namespace */
let namespace = "1b671a64-40d5-491e-99b0-da01ff1f3341";
let uuidv3_3 = Uuid.V3.uuidv3("Hello, world!", Uuid.Custom(namespace));
let uuidv3_1 = Uuid.V3.uuidv3 "hello.example.com" Uuid.DNS
let uuidv3_2 = Uuid.V3.uuidv3 "http://example.com/hello" Uuid.URL
let namespace = "1b671a64-40d5-491e-99b0-da01ff1f3341"
let uuidv3_3 =
  Uuid.V3.uuidv3 "Hello, world!"
    ((Uuid.Custom (namespace))[@explicit_arity ])

Version 4 (random)

  • RE
  • ML
let uuidv4 = Uuid.V4.uuidv4();
let uuidv4 = Uuid.V4.uuidv4 ()

Version 5 (namespace)

  • RE
  • ML
/* ...using predefined DNS namespace */
let uuidv5_1 = Uuid.V5.uuidv5("hello.example.com", Uuid.DNS);

/* ...using predefined URL namespace */
let uuidv5_2 = Uuid.V5.uuidv5("http://example.com/hello", Uuid.URL);

/* ...using a custom namespace */
let namespace = "1b671a64-40d5-491e-99b0-da01ff1f3341";
let uuidv5_3 = Uuid.V5.uuidv5("Hello, world!", Uuid.Custom(namespace)));
2540: syntax error, consider adding a `;' before

Development

yarn run start