Skip to content
A JavaScript library for converting between UUIDs and Process Street micro UUIDs ("Muids")
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test Fix issue with tests no longer working
.gitignore
.travis.yml
README.md Update README.md
bower.json
gulpfile.js
muid.js
package.json

README.md

muid.js Build Status

A JavaScript library for converting between UUIDs and Process Street micro UUIDs ("Muids").

Muids are URL-safe and take up 31.25% less characters than UUIDs while encoding the same amount of information.

Installation

In a browser:

<script src="muid.js"></script>

Via bower:

bower install muid.js

Notes

This method will provides a global Muid object. That means that once you include it, you can use it like this:

var uuid = '19ab5c32-038b-4ba3-841f-b427f65e1943';
var muid = Muid.fromUuid(uuid);
// = 'hB-0J_ZeGUMZq1wyA4tLow'

The fromUuid is case-insensitive (i.e. you can pass 19ab5c32-038b-4ba3-841f-b427f65e1943 or 19AB5C32-038B-4BA3-841F-B427F65E1943 and dash-insensitive (i.e. 19ab5c32-038b-4ba3-841f-b427f65e1943 or 19ab5c32038b4ba3841fb427f65e1943 are treated the same).

A toUuid function is also provided for converting a Muid to a UUID:

var muid = 'hB-0J_ZeGUMZq1wyA4tLow';
var uuid = Muid.toUuid(muid);
// = '19ab5c32-038b-4ba3-841f-b427f65e1943'

Why not just use UUIDs?

The motivation behind Muids is that they take up 22 characters instead of 32. This leads to Muids taking up 31.25% less space in URLs than UUIDs.

Author

twitter/cdmckay
Cameron McKay

License

This library is available under the MIT license.

Something went wrong with that request. Please try again.