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

@judo/expressions

v0.1.1

Published

Expression language integration for JUDO UI Runtime, wrapping @judo/idem

Readme

@judo/expressions

Expression language integration for JUDO UI Runtime, wrapping @judo/idem

Purpose

Provides a React context-based integration for the @judo/idem expression evaluator. Creates a pre-configured EvalExpr instance with date-fns date functions and shares it via React context so any component in the tree can evaluate IDEM expressions (arithmetic, logic, string functions, collection operations, date manipulation) against runtime data.

Architecture Layer

Layer 2 (Cross-cutting) — consumed by components and higher layers for expression evaluation (e.g., visibility conditions, computed labels, guard expressions).

Dependencies

  • @judo/idem — IDEM expression language evaluator (dependency)
  • antlr4ng ^3 — ANTLR4 runtime required by @judo/idem (peer)
  • date-fns ^4 — date manipulation functions injected into the evaluator (peer)
  • react ^19 — React runtime (peer)

File Structure

src/
├── index.ts                          # Barrel re-exports + type re-exports from @judo/idem
├── expression-context.tsx            # ExpressionProvider, useExpression, useExpressionOptional
└── expression-context.test.tsx       # Full test suite (53 tests)

Exports Summary

| Export | Kind | Description | | ------------------------- | --------- | -------------------------------------------------------------------------------------------------- | | ExpressionProvider | component | React provider that creates a configured EvalExpr instance (memoized) and shares it via context. | | ExpressionProviderProps | interface | Props for ExpressionProvider: { children: ReactNode }. | | useExpression() | hook | Returns the EvalExpr function from context. Throws if used outside ExpressionProvider. | | useExpressionOptional() | hook | Returns the EvalExpr function or null if no provider is in the tree. Safe for optional usage. | | EvalExpr | type | Re-exported from @judo/idem. The evaluator function signature: <T>(expr: string, ctx?) => T. | | Self | type | Re-exported from @judo/idem. The context type for self references in expressions. |

Key Patterns

  • Single memoized instance: ExpressionProvider creates the EvalExpr evaluator once via useMemo([], ...) and reuses it across re-renders
  • Date function injection: The provider configures @judo/idem with date-fns functions (addDays, subDays, parseISO, differenceInDays, differenceInSeconds) for date expression support
  • Type re-exports: Core types (EvalExpr, Self) are re-exported from @judo/idem for consumer convenience, avoiding direct @judo/idem imports in consuming packages
  • Throw vs null pattern: useExpression() throws for mandatory usage; useExpressionOptional() returns null for optional/conditional usage
  • No configuration props: The provider takes no configuration — the evaluator setup is fixed with the standard date functions

Supported Expression Features

The @judo/idem evaluator (exposed through this package) supports:

| Category | Examples | | ----------- | -------------------------------------------------------------------- | | Arithmetic | +, -, *, /, mod, ^, unary -, parentheses | | Comparison | ==, !=, <, >, <=, >= | | Logical | and, or, not, xor, ternary ? : | | Literals | strings ('...'), numbers, booleans, null, decimals | | Self access | self.prop, self.nested.prop, null-safe navigation | | Strings | !lowerCase(), !upperCase(), !length(), !trim() | | Null checks | !isDefined(), !isUndefined() | | Collections | !size(), !sum(), !min(), !max(), !avg(), !filter(), in | | Dates | today, date literals (`2024-01-15`), date-fns functions |