Skip to content

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

Notifications You must be signed in to change notification settings

hellopath/counter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published