UNPKG

wide-text

Version:
20 lines (19 loc) 600 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createWideText = void 0; /** * Create wide text from normal text * @param text Input text * @param options Options */ 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); } exports.createWideText = createWideText; exports.default = createWideText;