1.0.4 • Published 6 years ago

next-text v1.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
6 years ago

travis-build-status npm-dependencies standard-js npm-node-version npm-version license

nextText is a small utility function to get the next letter from a partial string.

api

nextText

nextText creates an instance of nextText.

Params

text : String (required)

The complete string the module should iterate incrementally.

options : Object (optional)

You can override these options:

Option nameDefault valueDescription
restartfalseOnce the text has been iterated, restart from the beginning.

nextTextInstance

The return value of calling nextText(string[, options]).

Methods

.toString

Returns the current value of the instance.

.next

Returns the next instance, with the updated current value.

usage

See Tests.

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
1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago