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

turbo-array

v1.2.4

Published

Turbo Array is a lightweight, high-performance, fast library that allows you to build lazy evaluation pipelines for arrays.

Readme

Turbo Array

Turbo Array is a lightweight, high-performance, fast library that allows you to build lazy evaluation pipelines for arrays. It supports operations like filter, map, reduce, forEach, find, some, every and join, executing them efficiently.

A method build with Turbo Array is 4x faster than vanilla version.

See live example with benchmark: https://stackblitz.com/edit/turbo-array

How it works

The build method constructs a function that processes the array in a single loop. This minimizes the number of iterations over the array, reducing the overhead compared to performing multiple passes for each operation. The operations (filter, map, reduce, forEach, join) are inlined into the generated function. This reduces the overhead of function calls and allows the JavaScript engine to optimize the code more effectively. The generated function includes conditional logic to skip unnecessary operations (e.g., skipping elements that do not pass the filter condition).This ensures that only relevant operations are performed on each element.

Installation

npm install turbo-array

Usage

import { turbo } from 'turbo-array';

// Create a pipeline (build it once)
const complexSum = turbo()
  .filter((n) => n % 2 === 0)
  .map((n) => n * 2)
  .reduce((acc, n) => acc + n, 0)
  .build(); // ⚡️ The build step optimizes the pipeline

// Reuse multiple times
complexSum([1, 2, 3, 4, 5]);
complexSum([6, 7, 8, 9, 10]);

If you need to pass a variable context to turbo method

import { turbo } from 'turbo-array';

type Context = { multiply: number };
declare var context: Context;

// Create a pipeline (build it once)
const complexSum = turbo<number, Context>()
  .filter((n) => n % 2 === 0)
  .map((n) => n * context.multiply)
  .reduce((acc, n) => acc + n, 0)
  .build(); // ⚡️ The build step optimizes the pipeline

// Reuse multiple times
complexSum([1, 2, 3, 4, 5], { multiply: 2 });
complexSum([1, 2, 3, 4, 5], { multiply: 3 });

How build works

The build method constructs a function that processes the array in a single loop. Eg.:

import { turbo } from 'turbo-array';

const complexSum = turbo()
  .filter((n) => n % 2 === 0)
  .map((n) => n * 2)
  .reduce((acc, n) => acc + n, 0)
  .build();

The complexSum() method become:

function anonymous(array, context) {
  "use strict";
  if (!Array.isArray(array)) throw new Error("Invalid parameters");
  const filter_0 = (n) => n % 2 === 0;
  const map_1 = (n) => n \* 2;
  const reduce_2 = (acc, n) => acc + n;
  let result = 0;
  let e = array.length, item;
  let idx = 0, i = 0;
  for (; i < e; i++, idx++) {
    item = array[i];
    if (!filter_0(item, idx)) {
      idx--;
      continue;
    }
    item = map_1(item, idx);
    result = reduce_2(result, item, idx);
  }
  return result;
}

Support

This is an open-source project. Star this repository, if you like it, or even donate. Thank you so much!