UNPKG

@nent/core

Version:

Functional elements to add routing, data-binding, dynamic HTML, declarative actions, audio, video, and so much more. Supercharge static HTML files into web apps without script or builds.

20 lines (17 loc) 586 B
/*! * NENT 2022 */ 'use strict'; /** * It removes the leading whitespace from a string * @param {string} innerText - The text to dedent. * @returns the string with the leading whitespace removed. */ function dedent(innerText) { const string = innerText === null || innerText === void 0 ? void 0 : innerText.replace(/^\n/, ''); const match = string === null || string === void 0 ? void 0 : string.match(/^\s+/); return match ? string === null || string === void 0 ? void 0 : string.replace(new RegExp(`^${match[0]}`, 'gm'), '') : string; } exports.dedent = dedent;