1.0.0 • Published 6 years ago
basic-paging v1.0.0
Basic Paging System
Links
Installation
npm install basic-paging
Source code
class Book {
constructor(pages){
this.pages = pages
this.index = 0
}
get length(){
return this.pages.length
}
turn(relative){
this.index += relative
if(this.index >= this.pages.length){
this.index = this.page.length - 1
}
if(this.index < 0){
this.index = 0
}
return this
}
read(reader){
return reader(this.pages[this.index])
}
}
1.0.0
6 years ago