Skip to content

Commit

Permalink
4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mojoaxel committed Dec 9, 2022
1 parent 7e59050 commit 29bc3b5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion browser.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Type definitions for pdf-merger-js v3.4.0
// Type definitions for pdf-merger-js v4.2.0
// Project: https://github.com/nbesli/pdf-merger-js
// Definitions by: Alexander Wunschik <https://github.com/mojoaxel/>
// Daniel Hammer <https://github.com/danmhammer/>
// Lukas Loeffler <https://github.com/LukasLoeffler>

declare module "pdf-merger-js/browser" {
class PDFMerger {
Expand Down
4 changes: 2 additions & 2 deletions browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class PDFMerger {

async _addFromToPage (inputFile, from, to) {
if (typeof from !== 'number' || typeof to !== 'number' || from < 0 || from < 0) {
throw new Error('Invalid function parameter. \'from\' and \'to\' must be possitive \'numbers\'.')
throw new Error('Invalid function parameter. \'from\' and \'to\' must be positive \'numbers\'.')
}
if (to < from) {
throw new Error('Invalid function parameter. \'to\' must be greater or eaqual to \'from\'.')
Expand All @@ -95,7 +95,7 @@ class PDFMerger {
const pageCount = srcDoc.getPageCount()

if (from >= pageCount || to >= pageCount) {
throw new Error(`Invalid function parameter. The document has not enought pages. (from:${from}, to:${to}, pages:${pageCount})`)
throw new Error(`Invalid function parameter. The document has not enough pages. (from:${from}, to:${to}, pages:${pageCount})`)
}

// create a array [2,3,4] with from=2 and to=4
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class PDFMerger {

async _addFromToPage (input, from, to) {
if (typeof from !== 'number' || typeof to !== 'number' || from < 1 || from < 1) {
throw new Error('Invalid function parameter. \'from\' and \'to\' must be possitive \'numbers\'.')
throw new Error('Invalid function parameter. \'from\' and \'to\' must be positive \'numbers\'.')
}
if (to < from) {
throw new Error('Invalid function parameter. \'to\' must be greater or equal to \'from\'.')
Expand All @@ -72,7 +72,7 @@ class PDFMerger {
const pageCount = srcDoc.getPageCount()

if (from > pageCount || to > pageCount) {
throw new Error(`Invalid function parameter. The document has not enought pages. (from:${from}, to:${to}, pages:${pageCount})`)
throw new Error(`Invalid function parameter. The document has not enough pages. (from:${from}, to:${to}, pages:${pageCount})`)
}

const pages = Array.from({ length: (to - from) + 1 }, (_, i) => i + from - 1)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pdf-merger-js",
"version": "4.1.2",
"description": "merge multible PDF documents, or parts of them, to a new PDF document",
"version": "4.2.0",
"description": "merge multiple PDF documents, or parts of them, to a new PDF document",
"main": "./index.js",
"types": "./index.d.ts",
"browser": "./browser.js",
Expand Down

0 comments on commit 29bc3b5

Please sign in to comment.