Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "abl-utils", | ||
"title": "ABL - utils", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "description": "description", |
"use strict"; | ||
import debug from "debug"; | ||
import querystring from "querystring"; | ||
import {getServerUrl} from "./misc"; | ||
import {makeError} from "./error"; | ||
@@ -54,31 +52,2 @@ import {translate} from "abl-lang"; | ||
export function addPaginationHeaders(request, response, count) { | ||
const last = Math.ceil(count / request.query.pageSize); | ||
const url = `${getServerUrl()}${request.route.path}?`; | ||
response.set("X-First-Page-Url", url + querystring.stringify({ | ||
pageSize: request.query.pageSize, | ||
page: 0 | ||
})); | ||
if (request.query.page !== 0) { | ||
response.set("X-Prev-Page-Url", url + querystring.stringify({ | ||
pageSize: request.query.pageSize, | ||
page: request.query.page - 1 | ||
})); | ||
} | ||
if (request.query.page !== last) { | ||
response.set("X-Next-Page-Url", url + querystring.stringify({ | ||
pageSize: request.query.pageSize, | ||
page: request.query.page + 1 | ||
})); | ||
} | ||
response.set("X-Last-Page-Url", url + querystring.stringify({ | ||
pageSize: request.query.pageSize, | ||
page: last | ||
})); | ||
} | ||
export function wrapJSON(method) { | ||
@@ -85,0 +54,0 @@ return (request, response, next) => { |
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
7901
166