UNPKG
typeit
Version:
latest (8.8.7)
next (7.0.0-rc14)
8.8.7
8.8.6
8.8.5
8.8.4
8.8.3
8.8.2
8.8.1
8.8.0
8.7.1
8.7.0
8.6.6
8.6.5
8.6.4
8.6.3
8.6.2
8.6.1
8.6.1-alpha.0
8.6.0
8.5.5
8.5.4
8.5.3
8.5.2
8.5.1
8.5.0
8.4.0
8.3.3
8.3.1
8.3.0
8.2.0
8.1.0
8.0.9
8.0.8
8.0.7
8.0.6
8.0.5
8.0.4
8.0.3
8.0.2
8.0.1
8.0.0
8.0.0-rc.6
8.0.0-rc.5
8.0.0-rc.4
8.0.0-rc.3
8.0.0-rc.2
8.0.0-rc.1
8.0.0-next.0
7.0.4
7.0.3
7.0.2
7.0.1
7.0.0
7.0.0-rc9
7.0.0-rc8
7.0.0-rc7
7.0.0-rc6
7.0.0-rc5
7.0.0-rc3
7.0.0-rc2
7.0.0-rc14
7.0.0-rc13
7.0.0-rc12
7.0.0-rc11
7.0.0-rc10
7.0.0-rc1
6.5.1
6.5.0
6.2.0
6.1.4
6.1.3
6.1.2
6.1.1
6.1.0
6.0.3
6.0.2
6.0.1
6.0.0
5.10.7
5.10.6
5.10.5
5.10.4
5.10.3
5.10.2
5.10.1
5.10.0
5.9.0
5.8.0
5.7.0
5.6.1
5.6.0
5.5.2
5.5.1
5.5.0
5.4.1
5.4.0
5.3.0
5.2.0
5.1.0
5.0.2
5.0.1
5.0.0
4.4.1
4.4.0
4.3.0
4.2.3
4.2.2
4.2.1
4.2.0
4.1.0
4.0.0
3.0.1
3.0.0
2.0.2
2.0.1
2.0.0
1.1.1
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
The most versatile animated typing utility on the planet.
typeitjs.com
alexmacarthur/typeit
typeit
/
src
/
helpers
/
updateCursorPosition.ts
13 lines
(11 loc)
•
247 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
let
updateCursorPosition
= (
steps
:
number
,
cursorPosition
:
number
,
printedCharacters
:
Element
[],
) => {
return
Math
.
min
(
Math
.
max
(cursorPosition + steps,
0
), printedCharacters.
length
, ); };
export
default
updateCursorPosition;