UCD.js Docs

Utils

Curated stable utility functions

Utils

The @ucdjs/utils package provides a curated stable utility facade for UCD.js consumers.

Installation

npm install @ucdjs/utils

Overview

This package exposes the stable subset of utility helpers that are safe to share with external consumers. More volatile implementation helpers remain in @ucdjs-internal/shared.

[!IMPORTANT] @ucdjs/utils is intentionally small. It only exposes helpers that are likely to be useful to external consumers.

Unicode Version Helpers

version.ts
import {
  getLatestStableUnicodeVersion,
  isStableUnicodeVersion,
  isValidUnicodeVersion,
} from "@ucdjs/utils";

isValidUnicodeVersion("16.0.0");
isStableUnicodeVersion("16.0.0");
getLatestStableUnicodeVersion();

API Error Guards

guards.ts
import { isApiError } from "@ucdjs/utils";

const result: unknown = await fetch("/api").then((r) => r.json());

if (isApiError(result)) {
  console.error(result.message);
}

Package Relationship

consumer code
  -> @ucdjs/utils
    -> curated public helpers

internal workspace code
  -> @ucdjs-internal/shared
    -> volatile/internal helper families

On this page