Download pool/shard011/JavaScript/0069020_Pagination.js from Variable-role/sajaniemi_variable_dataset_large: direct link, hf CLI and curl.
- Browser
- Download file 748 Bytes
-
https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069020_Pagination.js
- Command line
-
hf download hf://datasets/Variable-role/sajaniemi_variable_dataset_large/pool/shard011/JavaScript/0069020_Pagination.js
-
curl -L -o 0069020_Pagination.js https://huggingface.co/datasets/Variable-role/sajaniemi_variable_dataset_large/resolve/main/pool/shard011/JavaScript/0069020_Pagination.js
748 Bytes
| const objectAssign = require('object-assign') | |
| function Pagination(paging, options, fetcher) { | |
| this.currentPage = paging.currentPage | |
| this.pageSize = paging.pageSize | |
| this.totalPages = paging.totalPages | |
| this.totalResults = paging.totalResults | |
| this.hasNext = paging.currentPage < this.totalPages | |
| this.hasPrevious = paging.currentPage > 0 | |
| this.sort = paging.sort | |
| this.fetcher = fetcher | |
| this.options = options | |
| } | |
| Pagination.prototype.next = function () { | |
| return this.fetcher( | |
| objectAssign({}, this.options, {page: this.options.page + 1}) | |
| ) | |
| } | |
| Pagination.prototype.previous = function () { | |
| return this.fetcher( | |
| objectAssign({}, this.options, {page: Math.max(0, this.options.page - 1)}) | |
| ) | |
| } | |
| module.exports = Pagination | |