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

@_solaris/expression-parser

v0.1.3

Published

Type-safe consumers for ww-expression-editor output — AST evaluation, template rendering, and filter evaluation across the three editor presets.

Downloads

471

Readme

@_solaris/expression-parser

Type-safe consumers for ww-expression-editor output. Pure TypeScript, zero runtime dependencies, works in Node, browser, and Deno.

The editor has three presets, each with a different output shape. This package provides one consumer per preset, plus a standalone parser if you only have the raw expression string.

| Preset | Output | Consumer | |---|---|---| | condition | { expression, ast, valid, errors } | evaluate(ast, ctx) → boolean | | variableInsertion | { expression, ast: null, valid, errors, variables } | render(expression, ctx) → string | | filterBuilding | { expression, ast: null, filters, valid, errors } | evaluateFilters(filters, item) → boolean |

Install

npm install @_solaris/expression-parser

Deno:

import { evaluate } from 'npm:@_solaris/expression-parser';

Usage by preset

condition — evaluate a boolean expression against a context

import { evaluate, type ExpressionOutput } from '@_solaris/expression-parser';

const output: ExpressionOutput = /* from the editor */;
const passes = evaluate(output.ast, { user: { age: 21, country: 'FR' } });
// → true / false

For non-boolean expressions (text, numbers, dates), use evaluateValue instead — it returns the raw value with no boolean assertion.

If you only have the raw expression string (e.g. read from a DB):

import { parse, evaluate } from '@_solaris/expression-parser';

const { ast, errors } = parse("user.age > 18 AND user.country in ['FR','US']");
if (errors.length === 0) evaluate(ast, ctx);

variableInsertion — render a template string

import { render, type TemplateOutput } from '@_solaris/expression-parser';

const output: TemplateOutput = /* from the editor */;
const text = render(output.expression, { user: { name: 'Alice', age: 30 } });
// "Bonjour Alice, tu as 30 ans"

For HTML/SQL/shell injection contexts, pass a format option to escape substituted values:

render(expression, ctx, { format: v => escapeHtml(String(v)) });

filterBuilding — pass through to a filter consumer, or evaluate locally

import { evaluateFilters, type FilterOutput } from '@_solaris/expression-parser';

const output: FilterOutput = /* from the editor */;

// Bind directly into ww-virtualized-list:
//   <ww-virtualized-list :filters="output.filters" filter-mode="and" />

// Or evaluate locally:
const items = data.filter(item => evaluateFilters(output.filters, item));

The local evaluator mirrors ww-virtualized-list's semantics (case-insensitive contains / startsWith / endsWith, numeric coercion for ordering, etc.). For other runtimes (e.g. PostgREST) you'll likely translate output.filters into the target query language rather than using evaluateFilters.

Sub-path imports (tree-shaking)

import { evaluate } from '@_solaris/expression-parser/expression';
import { parse }    from '@_solaris/expression-parser/parser';
import { render }   from '@_solaris/expression-parser/template';
import { evaluateFilters } from '@_solaris/expression-parser/filter';

Or grab everything namespaced:

import { expression, template, filter, parser } from '@_solaris/expression-parser';
expression.evaluate(...);
template.render(...);
filter.evaluateFilters(...);
parser.parse(...);

License

MIT