wide-text
Version:
Create w i d e t e x t from normal text
15 lines • 426 B
JavaScript
/**
* Create wide text from normal text
* @param text Input text
* @param options Options
*/
export function createWideText(text, options = {}) {
const {
charSep = 1,
wordSep = 2
} = options;
const actualCharSep = ' '.repeat(charSep);
const actualWordSep = ' '.repeat(wordSep);
return text.split(' ').map(word => Array.from(word).join(actualCharSep)).join(actualWordSep);
}
export default createWideText;