Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

handlebars-to-pdf

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

handlebars-to-pdf - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

38

index.js
//handlebars-to-pdf
var Check = require('freeman-check');
var Handlebars = require('handlebars');

@@ -8,25 +7,24 @@ var PDF = require('html-pdf');

create: function(options, callback){
//check arguments have been supplied correctly. Required template_html and template_data, optional layout_settings
var check_error = Check.test(options, {
template_html: "string",
template_data: "object"
}, {
layout_settings: {
format: "string",
orientation: "string",
border: {
top: "string",
right: "string",
bottom: "string",
left: "string"
}
}
});
//validate callback
if(typeof callback !== "function"){
throw new Error("No callback function supplied.");
return;
}
if(check_error instanceof Check.Error){
callback(check_error);
//check options have been supplied correctly. Required template_html and template_data, optional layout_settings
if(!options || typeof options !== "object"){
callback(new Error("`options` is malformatted or doesn't exist."), null);
return;
}
if(!options.template_html || typeof options.template_html !== "string"){
callback(new Error("`options.template_html` is malformatted or doesn't exist."), null)
return;
}
if(!options.template_data || typeof options.template_data !== "object"){
callback(new Error("`options.template_data` is malformatted or doesn't exist."), null)
return;
}
var output_layout = options.layout_settings || {

@@ -58,2 +56,2 @@ "format": "A4",

}
}
}
{
"name": "handlebars-to-pdf",
"version": "1.0.0",
"version": "1.0.1",
"description": "Turn a Handlebars template into a PDF. Receipts, contracts, statements etc. The choice is yours!",

@@ -16,3 +16,2 @@ "main": "index.js",

"dependencies": {
"freeman-check": "^1.0.1",
"handlebars": "^4.0.5",

@@ -19,0 +18,0 @@ "html-pdf": "^2.0.1"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc