pdfkit-table
Advanced tools
Comparing version 0.1.68 to 0.1.69
30
index.js
@@ -22,2 +22,3 @@ // jshint esversion: 6 | ||
* @param {Number} fillOpacity | ||
* @param {Function} callback | ||
*/ | ||
@@ -59,3 +60,3 @@ addBackground ({x, y, width, height}, fillColor, fillOpacity, callback) { | ||
* @param {Object} options | ||
* @returns | ||
* @param {Function} callback | ||
*/ | ||
@@ -749,11 +750,20 @@ table(table, options, callback) { | ||
*/ | ||
tables(tables, callback) { | ||
// if tables is Array | ||
Array.isArray(tables) ? | ||
// for each on Array | ||
tables.forEach( table => this.table( table, table.options || {} ) ) : | ||
// else is tables is a unique table object | ||
( typeof tables === 'object' ? this.table( tables, tables.options || {} ) : null ) ; | ||
// callback | ||
typeof callback === 'function' && callback(this); | ||
async tables(tables, callback) { | ||
return new Promise((resolve, reject) => { | ||
try { | ||
// if tables is Array | ||
Array.isArray(tables) ? | ||
// for each on Array | ||
tables.forEach( async table => await this.table( table, table.options || {} ) ) : | ||
// else is tables is a unique table object | ||
( typeof tables === 'object' ? this.table( tables, tables.options || {} ) : null ) ; | ||
// callback | ||
typeof callback === 'function' && callback(this); | ||
} catch (error) { | ||
reject(error); | ||
} | ||
}); | ||
} | ||
@@ -760,0 +770,0 @@ |
{ | ||
"name": "pdfkit-table", | ||
"version": "0.1.68", | ||
"version": "0.1.69", | ||
"description": "PdfKit Table. Helps to draw informations in simple tables using pdfkit. #server-side. Generate pdf tables with javascript (PDFKIT plugin) ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -54,3 +54,3 @@ <p align="center"> | ||
// the magic | ||
doc.table( table, options, callback ); | ||
doc.table( table, options, callback ); // is a Promise to async/await function | ||
@@ -385,3 +385,2 @@ // done! | ||
- striped {Boolean} (corsimcornao) | ||
- align cell ventically | ||
- colspan - the colspan attribute defines the number of columns a table cell should span. | ||
@@ -405,3 +404,3 @@ - sample with database | ||
// to save on server | ||
doc.pipe(fs.createWriteStream("./document-2.pdf")); | ||
doc.pipe(fs.createWriteStream("./my-table.pdf")); | ||
// tables | ||
@@ -416,3 +415,2 @@ await doc.table(table, options); | ||
+ added ***callback***. | ||
@@ -419,0 +417,0 @@ ```js |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
42131
3
581
588