npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

minimustache

v1.0.1

Published

Super minimal mustache implementation

Downloads

7

Readme

minimustache

Minimal templating engine, based on mustache's syntax, but with only the bare minimum feature. Up to 2x faster and 21x smaller than mustache.

Installation

npm install minimustache
yarn add minimustache
pnpm add minimustache
bun add minimustache

Usage

import minimustache from "minimustache";

const template = "Hello, {{name}}!";

const result = minimustache(template, { name: "world" });

console.log(result); // Hello, world!

Notes

minimustache does not sanitize the input. Thus, there's no triple-brace syntax or anything like that. If you need to escape HTML, you should do it yourself.

Size difference

In unpacked form, with CommonJS, ESM, and TypeScript definitions, minimustache is 5.3 kB. In comparison, mustache is 114 kB.

Performance

On an M1 processor, minimustache is between 1.12x and 2.05x faster than mustache, depending on the template and data.

If you wish to run the benchmark yourself, you can do so by cloning the repository, installing all dev depencies (bun i -D) and running bun bench.

Benchmark: Simple keys
  library                 hz     min      max    mean     p75     p99    p995    p999     rme   samples
· minimustache  3,132,448.49  0.0002  10.1032  0.0003  0.0003  0.0005  0.0008  0.0043  ±0.52%  15662243   fastest
· mustache      1,530,331.37  0.0003  87.1671  0.0007  0.0005  0.0014  0.0015  0.0128  ±4.95%   7651657

Benchmark: Advanced keys
  library               hz     min      max    mean     p75     p99    p995    p999     rme  samples
· minimustache  104,161.12  0.0066  90.7859  0.0096  0.0073  0.0277  0.0407  0.1919  ±6.17%   520806   fastest
· mustache       92,799.78  0.0080  34.8304  0.0108  0.0091  0.0359  0.0502  0.1442  ±2.27%   463999

Summary
  minimustache - Simple keys
    2.05x faster than mustache

  minimustache - Advanced keys
    1.12x faster than mustache