UNPKG

tm-text

Version:

Trackmania and Maniaplanet text parser and formatter

14 lines (13 loc) 580 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.humanize = void 0; const syntax_1 = require("../utils/syntax"); const tokenize_1 = require("./tokenize"); const humanize = (input, options) => { const tokens = typeof input === 'string' ? (0, tokenize_1.tokenize)(input, options) : input; return (0, tokenize_1.stringifyTokens)(tokens.filter(({ kind }) => kind === syntax_1.TOKEN.NEWLINE || kind === syntax_1.TOKEN.TAB || kind === syntax_1.TOKEN.WORD)); }; exports.humanize = humanize; exports.default = exports.humanize;