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 🙏

© 2026 – Pkg Stats / Ryan Hefner

reblaze

v0.4.0

Published

Rewrite JavaScript on the fly

Readme

          _     _
         | |   | |
 _ __ ___| |__ | | __ _ _______
| '__/ _ \ '_ \| |/ _` |_  / _ \
| | |  __/ |_) | | (_| |/ /  __/
|_|  \___|_.__/|_|\__,_/___\___|

A crazy way of template-izing your JS Functions and Generators so they can be generated on the fly.

This should be used for methods that are instantiated once then used many times, since currently the function generation does take quite a bit of time to do.

API

reblaze(values[, name], fn)

  • values {Object}
  • name {String} Default ''
  • fn {Function}
  • Returns new Function

Examples

Let's show a simple example then allow you to go experiment.

'use strict';

const reblaze = require('reblaze');

function Matrix(rows, cols) {
  this._rows = rows >>> 0;
  this._cols = cols >>> 0;
  // Replace template entries with fields in passed object.
  this.sumCols = reblaze({ COLS: this._cols, ROWS: this._rows }, sumCols);

  this._data = new Uint32Array(this._rows * this._cols);
}

// This will look funky due to the template convention.
function sumCols() {
  const data = this._data;
  // Sum of values may exceed a uint32
  const sum = new Float64Array(((COLS)));
  for (var i = 0; i < ((COLS)) * ((ROWS)); i++) {
    sum[i % ((COLS))] += data[i];
  }
  return sum;
}

// Build a new Matrix instance with custom sumCols().
const m = new Matrix(11, 7);

Now sumCols on the instance m:

function sumCols() {
  const data = this._data;
  const sum = new Float64Array(7);
  for (var i = 0; i < 7 * 11; i++) {
    sum[i % 7] += this[i];
  }
  return sum;
}

It will also automatically take care of object properties as well. For example:

function runMe(foo) {
  return foo[((BAR))];
}

const fn = reblaze({ BAR: 'bar' }, runMe);

And the output for the new fn instance:

function runMe(foo) {
  return foo.bar;
}

The name of the function can also be replaced by passing a second optional argument.

function replaceMe(foo) {
  return foo[((BAR))];
}

const fn = reblaze({ BAR: 'bar' }, 'wereReplaced', replaceMe);

Will generate the following function:

function wereReplaced(foo) {
  return foo.bar;
}

If you want to have the full require, __filename, etc. in your function pass module as an optional third (or second if name isn't provided) argument.

function foop() {
  require(__dirname + '/' + ((NAME)));
}
reblaze({ NAME: 'mod_name' }, module, foop);

So, give it a whirl and report any bugs. In the future I plan on implementing even more meta-ness where reblaze can run on itself and return optimized instances for a given construction case.