Utils
Kws3 internel helper functions for Svelte applications.
Current exported functions
-
truncate(str, len)
- truncates a stringstr
to specified lengthlen
-
nl2br(str)
- converts new lines to<br>
tags -
cloneObject(obj)
- deep clones an object -
rAF
- returns a cross-browser version ofrequestAnimationFrame
-
debounce(func, threshold, immediate)
- Debounces a functionfunc
so that it can be called only once within thethreshold
time period. Optional third param specifies whetherfunc
should be invoked immediately on first call.