Slugid.nice constructor

Slugid.nice()

Create a slugid in nice format.

This is a Url-safe base64 encoded UUID v4, with the first bit cleared to ensure that the base64 encoded identifier doesn't start with dash -. This costs some entropy, but makes the slugid nice to use in command line utilitites, as it doesn't start with dash.

Implementation

Slugid.nice() : _bytes = Slugid.v4()._bytes {
  // Clear the first bit to ensure [A-Za-f] as first character
  _bytes[0] = _bytes[0] & 0x7f;
}