aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2021-04-15 23:06:26 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2021-04-15 23:06:26 +0200
commit58f7d52150456713d3132408668a92d0f6f3d084 (patch)
tree4b346042a684e416e53c4f4ac779060b832ad227 /src/utils
parent63c3da2af27fcfb1a9893ade03543e3a30949c8d (diff)
Port to sveltekit
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/glyph_hash.js25
1 files changed, 4 insertions, 21 deletions
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);
};