Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
tarkine - A powerful and flexible template engine for Node.js applications.
Tarkine is a powerful and flexible template engine for Node.js applications. It provides a simple syntax for creating dynamic HTML templates with various features like comments, escaping, conditionals, loops, includes, blocks, and code execution.
npm install tarkine
const tarkine = require('tarkine');
const output = tarkine.renderFile("./template.html", {
username: "John Doe",
html: "<span>Some HTML</span>",
status: true,
array: [1, 2, 3],
object: {
username: "johndoe",
age: 30
},
});
console.log(output);
const tarkine = require("tarkine") // import
const express = require("express")
const app = express()
app.set("view engine", "html")
app.engine("html", tarkine.renderFile)
app.get("/", (req, res) => {
res.render("index", {
username: "tarkine"
})
})
app.listen(3000)
{{# This is a comment }}
{{ variable }} // Escaped output
{{- variable }} // Unescaped output
{{= variable }} // Fully escaped output (including includes)
{{ if(condition) }}
// content
{{ else if(otherCondition) }}
// content
{{ else }}
// content
{{/}}
{{ for(value, index in array) }}
// content
{{/}}
{{ for(value, key in object) }}
// content
{{/}}
{{ include("./partial", { data: "value" }) }}
{{~
// JavaScript code here
}}
<div>
<button disabled="isLoggedIn">Login</button>
<button disabled="isLoggedIn === true">Login</button>
</div>
const tarkine = require('tarkine')
tarkine.register({
siteName: 'My Website'
})
<p>{{ capitalize('hello world') }}</p> <!-- Output: "Hello world" -->
<p>{{ uppercase('hello') }}</p> <!-- Output: "HELLO" -->
<p>{{ lowercase('HELLO') }}</p> <!-- Output: "hello" -->
<p>Random number: {{ randomNum(1, 100) }}</p> <!-- Output: Random number between 1 and 100 -->
<p>Random string: {{ randomStr(10) }}</p> <!-- Output: Random string of 10 characters -->
<p>Random character: {{ randomChar() }}</p> <!-- Output: A random letter -->
<p>Formatted date: {{ formatDate('2024-01-01', 'MM/DD/YYYY') }}</p> <!-- Output: "01/01/2024" -->
<p>Formatted time: {{ formatTime('2024-01-01T15:30:00') }}</p> <!-- Output: "15:30:00" -->
<p>{{ timeSince('2023-01-01T00:00:00Z') }}</p> <!-- Output: "X days ago" -->
<p>{{ truncate('This is a long sentence that needs truncation', 20) }}</p> <!-- Output: "This is a long se..." -->
<p>{{ slugify('Hello World! This is a test') }}</p> <!-- Output: "hello-world-this-is-a-test" -->
<p>{{ currency(1234.56) }}</p> <!-- Output: "$1,234.56" -->
<p>{{ currency(1234.56, 'EUR', 'de-DE') }}</p> <!-- Output: "1.234,56 €" -->
<p>{{ pluralize(1, 'apple', 'apples') }}</p> <!-- Output: "apple" -->
<p>{{ pluralize(2, 'apple', 'apples') }}</p> <!-- Output: "apples" -->
<p>{{ formatBytes(1024) }}</p> <!-- Output: "1 KB" -->
<p>{{ isEmail('test@example.com') }}</p> <!-- Output: true -->
FAQs
tarkine - A powerful and flexible template engine for Node.js applications.
We found that tarkine demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.