ccounter

1.1.2 • Public • Published

Counter

Just a simple counter that when comes to the end go back to zero and when go less than zero return to total index

Properties:
index //current index
total //total items
prev //previous index
next //next index

Example:

var totalLength = 3
// Starts from 0, you can specify a start index as second parameter
var counter = Counter(totalLength, startIndex)
counter.inc() // counter = 1
counter.inc() // counter = 2
counter.dec() // counter = 1
counter.dec() // counter = 0
counter.dec() // counter = 2

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.21latest

Version History

VersionDownloads (Last 7 Days)Published
1.1.21
1.1.11
1.1.01
1.0.21
1.0.11
1.0.01

Package Sidebar

Install

npm i ccounter

Weekly Downloads

6

Version

1.1.2

License

ISC

Last publish

Collaborators

  • hellopath