Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
micromustache
Advanced tools
A stripped down version of the {{mustache}} template engine with JavaScript
#Download
[Development Edition] (https://raw.github.com/hanifbbz/micromustache/master/dist/micromustache.js) - 2,226 Bytes
[Production Edition] (https://raw.github.com/hanifbbz/micromustache/master/dist/micromustache.min.js) - 378 Bytes
Or use npm:
npm install micromustache
#MicroMustache
A stripped down version of the {{mustache}} template engine with JavaScript. It covers the most important use case for Mustache: replacing variables with their names. MicroMustache doesn't support partials, array and nested objects. It is about 40% faster than Mustache.js and 93% smaller!
#Features
#Limitations
MicroMustache achieved great speed and light weight by dropping the following features from Mustache:
#How to use
MicroMustache is pretty similar to Mustache so if you know how to use Mustache, you can easily replace it with MicroMustache without any code change.
var person = {
first: "Alex",
last: "Ewerlöf"
};
//The render function accepts two parameters: the template and the object that contains a list of key-values to be replaced in template.
var output = MicroMustache.render("MicroMustache is created by {{first}} {{ last }}", person);
//output = "MicroMustache is created by Alex Ewerlöf"
Alternatively you can compile the template and get a function that can be used multiple times:
var templateEngine = MicroMustache.compile("MicroMustache is created by {{first}} {{ last }}");
output = templateEngine(person);
//output = "MicroMustache is created by Alex Ewerlöf"
output = templateEngine({first:'Albert',last:'Einstein'});
//output = "MicroMustache is created by Albert Einstein"
The following functions from Mustache.js are supported:
MicroMustache.render(template,view);//renders a template based on the data in the view object
MicroMustache.to_html(template,view);//same as render
MicroMustache.compile(template);//returns a function that accepts the view object and spits out the rendered string
For more examples see the micromustache-test.js inside the test directory above.
FAQs
A fast, minimal and secure template engine for JavaScript
The npm package micromustache receives a total of 31,433 weekly downloads. As such, micromustache popularity was classified as popular.
We found that micromustache demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.