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

btrz-pdf

Package Overview
Dependencies
Maintainers
1
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 1.9.0 to 1.10.0

2

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

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

function Localizer(engine) {
this.registerTag("t", {
parse: function(tagToken, remainTokens) {
this.str = tagToken.args;
const args = tagToken.args.split("|");
this.str = (args[0] || "").trim();
if (args.length > 1) {
this.tags = args.slice(1);
}
},

@@ -9,4 +13,7 @@ render: async function(ctx) {

if (ctx && ctx.environments && ctx.environments.localizer && ctx.environments.localizer.get) {
return ctx.environments.localizer.get(str);
str = ctx.environments.localizer.get(str);
}
if (this.tags) {
return await this.liquid.evalValue(`'${str}'|${this.tags}`, ctx);
}
return str;

@@ -13,0 +20,0 @@ }

@@ -135,2 +135,5 @@ describe("index.js", () => {

}
if (key === "text") {
return "text here please";
}
return `=>${key}`;

@@ -193,2 +196,19 @@ }

it("should apply tag after translations", async () => {
const pdf = require("../src/index");
const template = `{
"content": [
"{% t 'text' | upcase %}"
]
}`;
data.ticket.total = 0;
data.ticket.ssrs[0].subTotal = 0;
const documentDefinition = await pdf.toDocumentDefinition(template, data);
expect(documentDefinition).to.be.eql({
"content": [
"TEXT HERE PLEASE"
]
});
});
it("should return money even when values is zero", async () => {

@@ -195,0 +215,0 @@ const pdf = require("../src/index");

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