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

btrz-pdf

Package Overview
Dependencies
Maintainers
0
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

btrz-pdf - npm Package Compare versions

Comparing version 2.10.0 to 2.11.0

2

package.json
{
"name": "btrz-pdf",
"version": "2.10.0",
"version": "2.11.0",
"description": "Generates pdf documents based on a liquid template",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -162,6 +162,8 @@ const {timezones, BzDate} = require("bz-date");

render: async function(ctx) {
if (ctx && ctx.environments && ctx.environments.providerPreferences && ctx.environments.providerPreferences.preferences &&
ctx.environments[this.item] && ctx.environments[this.item][this.propName]) {
if (ctx && ctx.environments && ctx.environments.providerPreferences && ctx.environments.providerPreferences.preferences) {
const format = ctx.environments.providerPreferences.preferences.dateFormat;
return getDate(ctx.environments, this.item, this.propName, format, this.applyTimeZone);
const item = await getNameOrValue(this.item, this.propName, ctx, this.liquid);
if (item) {
return getDate(ctx.environments, item, this.propName, format, this.applyTimeZone);
}
}

@@ -168,0 +170,0 @@ return "PNA";

@@ -58,3 +58,7 @@ describe("index.js", () => {

}
]
],
updatedAt: {
value: "2021-12-20T16:08:00.488Z",
offset: 0
}
},

@@ -611,6 +615,2 @@ providerPreferences: {

];
data.transaction.updatedAt = {
value: "2021-12-20T16:08:00.488Z",
offset: 0
};
const pdf = require("../src/index");

@@ -643,2 +643,35 @@ const template = `{

it("should format dateF outside and inside a for loop", async () => {
data.things = [
{
data: {createdAt: {value: "2021-12-21T16:38:22.488Z", offset: 0}}
},
{
data: {createdAt: {value: "2021-12-22T16:32:22.488Z", offset: 0}}
}
];
const pdf = require("../src/index");
const template = `{
"content": [
{%- for thing in things -%}
"{%- dateF thing.data createdAt %}",
"{%- dateF thing.data wrongProp %}",
{%- endfor -%}
"{%- dateF transaction updatedAt %}",
"{%- dateF transaction wrongProp %}"
]
}`;
const documentDefinition = await pdf.toDocumentDefinition(template, data);
expect(documentDefinition).to.be.eql({
"content": [
"12/21/2021",
"PNA",
"12/22/2021",
"PNA",
"12/20/2021",
"PNA",
]
});
});
it("should return a pdf document", (done) => {

@@ -645,0 +678,0 @@ const pdf = require("../src/index.js");

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