New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

micro-engine

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

micro-engine

Micro template engine

latest
npmnpm
Version
0.0.1
Version published
Weekly downloads
221
-7.92%
Maintainers
1
Weekly downloads
 
Created
Source

Micro

Description

A tiny template engine, with javascript execution isolation.

Purpose

Just for fun.

Installation

[sudo] npm i micro-engine

Usage API

Calling the module

var micro = require('micro-engine');

Definition

var content = micro('{{ message }}');

Compile

content.compile({ message: 'Hello World!' });
// Hello World!

Run

var content = micro('{{ var result = firstValue + secondValue; }}');
content.run({ 
  firstValue: 2, 
  secondValue: 3 
});

// { 
//    firstValue: 2, 
//    secondValue: 3, 
//    result: 5, 
//    _compiled: "var result = 2 + 3;" 
// } 

Render

var content = micro('{{ var result = firstValue + secondValue; }}');
content.render({ 
  firstValue: 2, 
  secondValue: 3 
}, '{{ result, firstValue, secondValue }}');

// 5, 2, 3

Working with files

some-file.mic
-------------

{{ var result = firstValue + secondValue; }}
var content = micro.file( './some-file' );
content.render({ 
  firstValue: 2, 
  secondValue: 3 
}, '{{ result, firstValue, secondValue }}');

// 5, 2, 3

License

Under BSD

Keywords

template

FAQs

Package last updated on 13 Jan 2014

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