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.

18 lines (16 loc) 570 B
/*! * NENT 2022 */ /** * 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; } export { dedent as d };