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

@greffon/provider-memory

v0.1.1

Published

Greffon reference provider — runs queries in memory via compiled lambdas.

Readme

@greffon/provider-memory

The reference provider of Greffon, expression trees for TypeScript. It executes a QueryPlan over plain arrays by running the compiled lambdas — filter is Array.prototype.filter — through the shared engine in @greffon/query. It defines correct behavior: every other provider is conformance-tested against its results.

Use it in tests and fixtures with the same query files that compile to SQL in production. Plain lambdas need no build plugin here — the provider calls the function; only navigation predicates (u.orders?.some(…)) read the tree.

Install

npm install @greffon/provider-memory

Usage

import { createContext } from "@greffon/query";
import { memoryProvider } from "@greffon/provider-memory";

interface User { id: number; name: string; age: number; active: boolean }

const users: User[] = [
  { id: 1, name: "Ada", age: 36, active: true },
  { id: 2, name: "Bob", age: 17, active: true },
];

const db = createContext<{ users: User }>(memoryProvider({ users }));

const adults = await db.users
  .filter((u) => u.age >= 18 && u.active)
  .map((u) => ({ id: u.id, name: u.name }))
  .toArray(); // [{ id: 1, name: "Ada" }]

Hand the same chain a SQL provider instead and it compiles to one parameterized statement — swap the provider, keep the query file.

API

  • memoryProvider(data): a QueryProvider over arrays keyed by source name. It supports every plan op; a plan naming an unknown source is refused with a coded R2002. explain() returns the op chain, e.g. memory scan: users (filter → map).
  • MemoryData: the fixtures shape, { [source]: rows }.

The semantics every other provider must reproduce are defined here: stable multi-level ordering (nulls last when ascending, first when descending), value-equality distinct, null join keys matching nothing, every true on an empty result. One deliberate looseness: this provider accepts an opaque function reference (it just calls it), where a SQL provider rejects the same query with R2003 — a passing in-memory test is not proof a query translates.

Docs

License

MIT