mirror of
https://github.com/Lissy93/dashy.git
synced 2025-12-21 07:53:16 +01:00
13 lines
647 B
JavaScript
13 lines
647 B
JavaScript
import { hideFurnitureOn } from '@/utils/defaults';
|
|
|
|
/* Returns false if page furniture should be hidden on said route */
|
|
export const shouldBeVisible = (routeName) => !hideFurnitureOn.includes(routeName);
|
|
|
|
/* Very rudimentary hash function for generative icons */
|
|
export const asciiHash = (input) => {
|
|
const str = (!input || input.length === 0) ? Math.random().toString() : input;
|
|
const reducer = (previousHash, char) => (previousHash || 0) + char.charCodeAt(0);
|
|
const asciiSum = str.split('').reduce(reducer).toString();
|
|
const shortened = asciiSum.slice(0, 30) + asciiSum.slice(asciiSum.length - 30);
|
|
return window.btoa(shortened);
|
|
};
|