UNPKG

themer

Version:

Customizable theme creator for editors, terminals, wallpaper, and more.

21 lines (20 loc) 791 B
import { source } from 'common-tags'; export const listOutputFiles = (paths) => source ` Files generated: ${paths.map((p) => `* \`${p}\``).join('\n')} `; export function weightedRandom(map) { if (map.size === 0) throw new Error('weightedRandom map must have values'); const cumulativeWeights = [...map.values()].reduce((c, weight, i) => c.concat(weight + (c[i - 1] || 0)), []); const random = (cumulativeWeights[cumulativeWeights.length - 1] || 0) * Math.random(); return [...map.keys()][cumulativeWeights.findIndex((cw) => random < cw)]; } export const version = '5.0.1'; export function join(...parts) { return parts.join('/'); } export function dirname(path) { return path.substring(0, path.lastIndexOf('/')); } //# sourceMappingURL=index.js.map