Skip to content

Commit

Permalink
Adds support for data field (minor)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrrrzzt committed Apr 18, 2018
1 parent 43d0c92 commit 2cfc0b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/steps/convert-docx-to-pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ const convertToPdf = require('../convert-to-pdf')

module.exports = data => {
return new Promise(async (resolve, reject) => {
let jobs = data.documents.map(data => data.file)
let jobs = data.documents.map(document => document.file || document.data)
let counter = 0

const next = async () => {
if (jobs.length > 0) {
const document = jobs.shift()
data.documents[counter].file = await convertToPdf(document)
if (data.documents[counter].file) {
data.documents[counter].file = await convertToPdf(document)
}
if (data.documents[counter].data) {
data.documents[counter].data = await convertToPdf(document)
}
counter++
await next()
} else {
Expand Down

0 comments on commit 2cfc0b7

Please sign in to comment.