X-Git-Url: https://git.r.bdr.sh/rbdr/forum/blobdiff_plain/c64352ff6be4d9c05df37f02212e2e409435fc31..f088a6594c15951b85a56129944afa51a62dc765:/src/utils/glyph_hash.js diff --git a/src/utils/glyph_hash.js b/src/utils/glyph_hash.js index cbbf988..13a81a8 100644 --- a/src/utils/glyph_hash.js +++ b/src/utils/glyph_hash.js @@ -1,38 +1,21 @@ const internals = { kSplitterRegex: /.{1,8}/g, - kGlyphs: [ - '☽', - '☆', - '♢', - '♡', - '╱', - '╲', - '╳', - '〰', - '▷', - '⏊', - '〒', - '▢', - '◯', - '⏃', - '⏀', - '⏆' - ] + kGlyphs: ['☽', '☆', '♢', '♡', '╱', '╲', '╳', '〰', '▷', '⏊', '〒', '▢', '◯', '⏃', '⏀', '⏆'] }; // Return a glyph with color based on a 4 byte fragment of a UUIDv4 const getGlyphHashFragment = function (uuidFragment) { - const glyphIndex = parseInt(uuidFragment.substring(0,2), 16) % 16; + const glyphIndex = parseInt(uuidFragment.substring(0, 2), 16) % 16; return { glyph: internals.kGlyphs[glyphIndex], - color: `#${uuidFragment.substring(2,8)}` + color: `#${uuidFragment.substring(2, 8)}` }; }; // Return an array of glyphs based on a UUIDv4 export const getGlyphHash = function (uuid) { - const hashFragments = uuid.replace(/[-]/g,'').match(internals.kSplitterRegex); + const hashFragments = uuid.replace(/[-]/g, '').match(internals.kSplitterRegex); return hashFragments.map(getGlyphHashFragment); };