laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
14 lines (13 loc) • 325 B
JavaScript
"use client";
function c(r, t) {
const o = String(r);
let e = o.indexOf(t), n = e, i = 0, l = 0;
if (typeof t != "string")
throw new TypeError("Expected substring");
for (; e !== -1; )
e === n ? ++i > l && (l = i) : i = 1, n = e + t.length, e = o.indexOf(t, n);
return l;
}
export {
c as longestStreak
};