nextText is a small utility function to get the next letter from a partial string.
nextText
creates an instance of nextText.
The complete string the module should iterate incrementally.
You can override these options:
Option name | Default value | Description |
---|---|---|
restart | false | Once the text has been iterated, restart from the beginning. |
The return value of calling nextText(string[, options])
.
Returns the current value of the instance.
Returns the next instance, with the updated current value.
const nextText = require('next-text')
let text = nextText('This is a test')
console.log(text.toString()) // ''
text = text.next()
console.log(text) // 'T'
text = text.next()
console.log(text) // 'Th'
text = text.next()
console.log(text) // 'Thi'
text = text.next()
console.log(text) // 'This'
text = text.next()
console.log(text) // 'This '
text = text.next()
console.log(text) // 'This i'
text = text.next()
console.log(text) // 'This is'
// you get the point