Socket
Book a DemoInstallSign in
Socket

expressive-template

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

expressive-template

A simple templating engine that's allows for the template replacements to be tracked as text ranges

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
7
Maintainers
1
Weekly downloads
 
Created
Source

Expressive Template

Overview

The intention of this project was to write a simple template engine that allows for template changes to be easily tracked. Making it easy to see what text range was replaced/rendered.

Getting Started

npm install -S expressive-template

JavaScript Examples

Render a template and view the first rendered expression's text range

const {renderTemplateExpressionsWithContext} = require('expressive-template');

const results = renderTemplateExpressionsWithContext('\n{{ first }}\n, {{ name }}', {
    first: 'Hey',
    name: 'Jason'
});

console.log(results.text); // '\nHey\n, Jason'

console.log(results.expressions[0].getCurrentRange()); // [ { column: 0, line: 1 }, { column: 0, line: 2 } ]

A basic template render

const {renderTemplate} = require('expressive-template');

const results = renderTemplate('Hello, {{ name }}', {name: 'Jason'});

console.log(results); // Hello, Jason

Keywords

expressive-template

FAQs

Package last updated on 11 Aug 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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.