@libj/pager
Advanced tools
Comparing version 0.1.1 to 0.2.0
import { PagerOptions, PagerRequest } from './types'; | ||
export declare class Pager<T = any> { | ||
private request; | ||
private options; | ||
constructor(// eslint-disable-line no-useless-constructor | ||
@@ -12,4 +11,5 @@ request: PagerRequest<T>, options?: PagerOptions); | ||
/*** Private ***/ | ||
private options; | ||
private page; | ||
private ended; | ||
} |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -6,2 +17,3 @@ exports.Pager = void 0; | ||
perPage: 25, | ||
initialPage: 1, | ||
}; | ||
@@ -13,7 +25,6 @@ var Pager = /** @class */ (function () { | ||
this.request = request; | ||
this.options = options; | ||
/*** Private ***/ | ||
this.page = 1; | ||
this.ended = false; | ||
} // eslint-disable-line no-empty-function | ||
this.options = __assign(__assign({}, DefaultOptions), options); | ||
this.page = this.options.initialPage; | ||
} | ||
/*** Public ***/ | ||
@@ -20,0 +31,0 @@ Pager.prototype.next = function () { |
export declare type PagerRequest<T = any> = (page: number, perPage: number) => Promise<T[]>; | ||
export interface PagerOptions { | ||
perPage?: number; | ||
initialPage?: number; | ||
} |
{ | ||
"name": "@libj/pager", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"description": "Abstract promise based pager", | ||
@@ -25,3 +25,3 @@ "author": "Sergey Poskachey <seregynp@gmail.com>", | ||
], | ||
"gitHead": "eb560f793fe4fb0020bbfe0e0b377c940fa4fa13" | ||
"gitHead": "c03aa6873de49627fc96bd0288e7d9f7408c1afc" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5144
90