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

@enonic/ui-utils

v0.4.0

Published

Framework-free helpers for Enonic UIs: the request transport and phrase lookup

Downloads

459

Readme

@enonic/ui-utils

Everything useful without a view layer: the request transport, the i18n core, and the values an XP form edits with the helpers that parse and format them.

Nothing here imports a component or a framework, and nothing reads state it did not create. That is the package's whole value — it can be used from a store, a worker, a test, or code that has no DOM at all, and a function's result depends on its arguments alone. Phrases come from the consumer, which fetches them from its own server and passes them in.

pnpm add @enonic/ui-utils              # the errors, the i18n core and the values, no peers
pnpm add @enonic/ui-utils neverthrow   # plus the transport, from '@enonic/ui-utils/request'

The root entry resolves nothing outside the package. The transport is its own entry, @enonic/ui-utils/request, and the only code that needs neverthrow: every request answers with its ResultAsync, so a consumer of the transport installs it and shares one copy of the class. neverthrow is therefore an optional peer.

What is here

| Export | What it does | | -------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | AppError | the base of every failure the package reports — name is a literal, cause rides the native Error option | | RequestError | a response with an error status: status, and the body's message when the body is JSON and has one, else the status text | | RequestAbortedError | a request its caller gave up on through signal | | requestJson<T>(url, options?) * | fetch a JSON body as ResultAsync<T, AppError>; options carries method, a JSON-serialized body, headers and signal | | requestOptionalJson<T>(url, options?) * | the same, with a 204 or an empty or null body resolving to undefined | | localize(phrases, key, ...values) | the phrase behind key with {0}-style placeholders filled by position; a missing key is #key# | | Translate | what an application hands @enonic/ui's I18nProvider: the key and the package's English in, the application's text or that English out | | passthrough | the Translate of an application that translates nothing | | fromPhrases(read) | a Translate over a phrase map, read at call time | | fromLookup(has, get) | a Translate over a has/get pair, as a Messages-style source offers | | bindPhrases(translate, fragment) | the typed t of one fragment, for a store or anything else outside a render | | mergePhrases(fragments) | one catalogue from a package's fragments, keys kept as a type; a key declared twice throws | | comparePhrases(catalog, bundle) | the catalogue keys a bundle lacks, and those whose placeholder set differs | | LocalDate, LocalTime, LocalDateTime | XP's zone-less date, time and date-time: fromString and fromDate in, toString and toDate out, equals by value | | DateTime | XP's instant, 2015-04-17T06:00:30.250Z; its fields are UTC | | GeoPoint, Reference, BinaryReference, Link | the other values a property holds, each its string and an equals | | parseTime, parseDateTime | 06:00[:30[.250]], and 2015-04-17 joined with it — undefined for anything else, a rolled-over day included | | formatDate, formatTime | the same strings from a Date or from hours, minutes and seconds | | pad, dateFromTime | the small helpers behind them | | parseRelativeTime(expression, now?) | the Date a form's default names: now, +1d, -2h +30m; isRelativeTime says whether a string is one | | * From @enonic/ui-utils/request. |

Part of the Enonic UI Toolkit.