dynamodb-toolbox
Version:
Lightweight and type-safe query builder for DynamoDB and TypeScript.
19 lines (18 loc) • 780 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseMaxPagesOption = void 0;
const dynamoDBToolboxError_js_1 = require("../errors/dynamoDBToolboxError.js");
const isInteger_js_1 = require("../utils/validation/isInteger.js");
const parseMaxPagesOption = (maxPages) => {
if (maxPages === Infinity) {
return maxPages;
}
if (!(0, isInteger_js_1.isInteger)(maxPages) || maxPages <= 0) {
throw new dynamoDBToolboxError_js_1.DynamoDBToolboxError('options.invalidMaxPagesOption', {
message: `Invalid limit option: '${String(maxPages)}'. 'limit' must be Infinity or an integer > 0.`,
payload: { maxPages }
});
}
return maxPages;
};
exports.parseMaxPagesOption = parseMaxPagesOption;