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

@cristianmartinez/yexp-cli

v0.0.1

Published

CLI for Yexp expression language

Readme

@cristianmartinez/yexp-cli

Command-line interface for Yexp expression language.

Installation

# From npm
npm install -g @cristianmartinez/yexp-cli

# From source
cd packages/cli
bun install
bun run build
npm link

Usage

# Basic property access (jq-style with '.')
echo '{"name": "Alice", "age": 30}' | yexp '.name'
# Output: "Alice"

# Array indexing
echo '{"users": [{"name": "Alice"}, {"name": "Bob"}]}' | yexp '.users[0].name'
# Output: "Alice"

# From file
yexp '.users[0].name' data.json

# Filter and map
echo '{"users": [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]}' | \
  yexp '.users.filter(u => u.age > 25).map(u => u.name)'
# Output: ["Alice"]

# Arithmetic
echo '{"price": 100, "tax": 0.1}' | yexp '.price * (1 + .tax)'
# Output: 110

# Template strings (use '$' to access input)
echo '{"name": "Alice"}' | yexp '`Hello, ${$.name}!`'
# Output: "Hello, Alice!"

# Access input explicitly with '$'
echo '{"name": "Alice"}' | yexp '$.name'
# Output: "Alice"

Options

  • -c, --compact - Compact output (no pretty-printing)
  • -r, --raw - Raw output (don't JSON-encode strings)
  • -f, --file <path> - Read from file instead of stdin
  • -h, --help - Show help
  • -v, --version - Show version

Examples

Filter Users by Age

cat users.json | yexp 'users.filter(u => u.age >= 21)'

Calculate Total

echo '{"items": [{"price": 10}, {"price": 20}]}' | \
  yexp 'items.map(i => i.price).reduce((a, b) => a + b, 0)'

Extract Nested Data

yexp '$.orders[0].items.map(i => i.name)' orders.json
# Or use jq-style leading dot:
yexp '.orders[0].items.map(i => i.name)' orders.json

Conditional Logic

echo '{"score": 85}' | yexp 'score >= 90 ? "A" : score >= 80 ? "B" : "C"'
# Output: "B"

File System Functions

The CLI includes built-in functions for file exploration, making yexp a composable alternative to find and grep.

glob(pattern)

Find files matching a glob pattern. Returns an array of file entries.

echo '{}' | yexp 'glob("src/**/*.ts") |> map(.name)'
# Output: ["index.ts", "functions.ts"]

echo '{}' | yexp 'glob("src/**/*.ts") |> filter(.size > 10000) |> sort(.size)'
# Find large TypeScript files

echo '{}' | yexp 'glob("**/*.ts") |> filter(.modified > now() - 86400000)'
# Files modified in the last 24 hours

Each file entry has: path, name, ext, size, modified, type.

read(path)

Read a file's contents as a string.

echo '{}' | yexp 'read("package.json") |> length'
# Output: 726

echo '{}' | yexp 'read("tsconfig.json")'
# Output: raw file contents

lines(path)

Read a file as an array of {num, text} objects.

echo '{}' | yexp 'lines("src/index.ts") |> filter(.text.includes("import")) |> map(.num)'
# Output: [1, 2, 3]

echo '{}' | yexp 'lines("src/index.ts") |> length'
# Count lines in a file

grep(pattern, pathGlob?)

Search file contents for a pattern. Returns {path, line, num, match} objects.

echo '{}' | yexp 'grep("TODO", "src/**/*.ts") |> groupBy(.path)'
# Find all TODOs grouped by file

echo '{}' | yexp 'grep("evaluate", "packages/core/src/*.ts") |> map(.path) |> unique'
# Find files containing "evaluate"

echo '{}' | yexp 'grep("/export\\s+const/", "src/**/*.ts")'
# Regex pattern (wrap in /slashes/)

Comparison with jq

| Feature | yexp | jq | |---------|------|-----| | Syntax | JavaScript-like | Custom DSL | | Performance | ⚡ Very fast | Fast (C implementation) | | Lambda functions | x => x.age | \| .age | | Use case | Embedded + CLI | CLI-focused |

Development

# Run without building
bun run dev 'expression' < input.json

# Build
bun run build

# Test
bun test