Skip to content

Instantly share code, notes, and snippets.

View kekscom's full-sized avatar

Jan Marsch kekscom

View GitHub Profile
@kekscom
kekscom / ID.js
Last active December 6, 2018 13:32
// Generate unique IDs for use as pseudo-private/protected names.
// Similar in concept to
// <http://wiki.ecmascript.org/doku.php?id=strawman:names>.
//
// The goals of this function are twofold:
//
// * Provide a way to generate a string guaranteed to be unique when compared
// to other strings generated by this function.
// * Make the string complex enough that it is highly unlikely to be
// accidentally duplicated by hand (this is key if you're using `ID`