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

lea-lang

v1.2.0

Published

A pipe-oriented functional programming language, embeddable in TypeScript

Readme

lea-lang

A pipe-oriented functional programming language, embeddable in TypeScript.

npm version Try Lea online

Installation

npm install lea-lang

CLI Usage

Run Lea files directly from the command line:

# Run via npx (no installation required)
npx lea-lang hello.lea

# Or install globally
npm install -g lea-lang
lea hello.lea

# Start interactive REPL
lea --repl

# Enable strict type checking
lea hello.lea --strict

# Initialize a new project
lea --init my-project

Quick Start

import { lea } from 'lea-lang';

// Simple pipe chain
const result = lea`
  [1, 2, 3, 4, 5]
    /> filter((x) -> x > 2)
    /> map((x) -> x * x)
    /> reduce(0, (acc, x) -> acc + x)
`;
// result = 50

JavaScript Interop

Interpolate JS values and functions directly into Lea code:

import { lea } from 'lea-lang';

// Interpolate values
const data = [1, 2, 3, 4, 5];
const threshold = 2;

const filtered = lea`${data} /> filter((x) -> x > ${threshold})`;
// [3, 4, 5]

// Interpolate functions
const double = (x: number) => x * 2;
const doubled = lea`${data} /> map(${double})`;
// [2, 4, 6, 8, 10]

// Records work too
const user = { name: "Max", age: 99 };
const name = lea`${user}.name`;
// "Max"

Async Support

Use leaAsync for code with await:

import { leaAsync } from 'lea-lang';

const result = await leaAsync`
  await delay(100)
  "done"
`;

Execution Context

Use createLea for reusable contexts with pre-defined bindings:

import { createLea } from 'lea-lang';

const ctx = createLea({
  data: [10, 20, 30],
  multiplier: 2,
  transform: (x: number) => x * 10,
});

ctx.run(`data /> map((x) -> x * multiplier)`);
// [20, 40, 60]

ctx.run(`data /> map(transform)`);
// [100, 200, 300]

// Async support
await ctx.runAsync(`await delay(100)`);

Lea Syntax Highlights

-- Pipes: value flows left to right
5 /> double /> print

-- Functions
let double = (x) -> x * 2

-- Spread pipe: map over lists concisely
[1, 2, 3] />>> (x) -> x * 2
-- [2, 4, 6]

-- Filter and reduce
[1, 2, 3, 4, 5]
  /> filter((x) -> x > 2)
  /> reduce(0, (acc, x) -> acc + x)

-- Records
let user = { name: "Max", age: 99 }
user.name /> print

-- Pattern matching
let describe = (x) -> match x
  | 0 -> "zero"
  | if input > 100 -> "big"
  | "other"

API Reference

lea

Tagged template literal for synchronous Lea execution.

function lea(strings: TemplateStringsArray, ...values: unknown[]): unknown

leaAsync

Tagged template literal for async Lea execution (supports await).

function leaAsync(strings: TemplateStringsArray, ...values: unknown[]): Promise<unknown>

createLea

Create a reusable execution context with bindings.

function createLea(bindings?: Record<string, unknown>): {
  run(source: string): unknown;
  runAsync(source: string): Promise<unknown>;
  set(name: string, value: unknown): void;
  bindings: Record<string, unknown>;
}

Links

License

MIT