laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
30 lines (29 loc) • 647 B
JavaScript
"use client";
function r(c) {
const i = String(c), s = /\r?\n|\r/g;
let e = s.exec(i), t = 0;
const n = [];
for (; e; )
n.push(
o(i.slice(t, e.index), t > 0, !0),
e[0]
), t = e.index + e[0].length, e = s.exec(i);
return n.push(o(i.slice(t), t > 0, !1)), n.join("");
}
function o(c, i, s) {
let e = 0, t = c.length;
if (i) {
let n = c.codePointAt(e);
for (; n === 9 || n === 32; )
e++, n = c.codePointAt(e);
}
if (s) {
let n = c.codePointAt(t - 1);
for (; n === 9 || n === 32; )
t--, n = c.codePointAt(t - 1);
}
return t > e ? c.slice(e, t) : "";
}
export {
r as trimLines
};