New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lard

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lard

Template render engine.

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by133.33%
Maintainers
1
Weekly downloads
 
Created
Source

lard

Build Status npm version

A HTML template renderer providing massive freedom to programmers.

Syntax

  1. <@@ arbitrary code to run @>. Don't use the resereved keyword _lardOutput unless you know what you are doing.

  2. <@ something defined in data evaluated to string @>. Almost equal to <@@ _lardOutput += something @>.

Usage

let lard = require('lard')

let tpl = `
    <div>
        <p><@ content @></p>
        <ul>
            <@@ for(let i = 0 ; i < users.length ; i ++) { user = users[i] @>
                <li>
                    <b><@ user.firstName @></b>
                </li>
            <@@ } @>
        </ul>
    </div>
`;

let data = {
  content: "fake content",
  users: [
    {
      firstName: "foo"
    },
    {
      firstName: "bar"
    }
  ]
};

let result = lard(tpl, data);

/* result: 
*   <div>
*       <p>fake content</p>
*       <ul>
*           <li>
*               <b>foo</b>
*           </li>
*           
*           <li>
*               <b>bar</b>
*           </li>
*       </ul>
*/  </div>

Arguments

Pass the following arguments to the exported function. All are optional.

tpl - String. Whether or not to be a jerk.

data - Object. Containing proterties will be evaluated to string.

opt - Object. Bag of settings.

Settings supported:

  • position - Boolean. If false, then don't track line/column/position when errors occurred in <@ ... @>. Default: true.

Keywords

FAQs

Package last updated on 07 Nov 2018

Did you know?

Socket

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.

Install

Related posts

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