-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updates to match latest linter (patch)
- Loading branch information
Showing
4 changed files
with
38 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
const convertToPdf = require('../convert-to-pdf') | ||
|
||
module.exports = data => { | ||
return new Promise(async (resolve, reject) => { | ||
let jobs = data.documents.map(document => !document.file ? document : document.file) | ||
let counter = 0 | ||
const next = async () => { | ||
if (jobs.length > 0) { | ||
const document = jobs.shift() | ||
if (data.documents[counter].file) { | ||
data.documents[counter].file = await convertToPdf(document) | ||
} else { | ||
data.documents[counter] = await convertToPdf(document) | ||
} | ||
counter++ | ||
await next() | ||
module.exports = async data => { | ||
const jobs = data.documents.map(document => !document.file ? document : document.file) | ||
let counter = 0 | ||
const next = async () => { | ||
if (jobs.length > 0) { | ||
const document = jobs.shift() | ||
if (data.documents[counter].file) { | ||
data.documents[counter].file = await convertToPdf(document) | ||
} else { | ||
resolve(data) | ||
data.documents[counter] = await convertToPdf(document) | ||
} | ||
counter++ | ||
await next() | ||
} else { | ||
return data | ||
} | ||
} | ||
|
||
await next() | ||
}) | ||
const result = await next() | ||
return result | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters