UCD.js Docs
Utilities

Utils

General utility functions

Utils

The @ucdjs/utils package provides general utility functions for the UCD.js ecosystem.

Installation

npm install @ucdjs/utils

Overview

This package re-exports shared utilities and provides general-purpose functions used across the monorepo.

Path Filtering

The package provides utilities for filtering file paths and tree structures, which is particularly useful when working with the Unicode file tree.

filter.ts
import { createPathFilter, filterTreeStructure, PRECONFIGURED_FILTERS } from "@ucdjs/utils";

// Create a filter for specific files
const filter = createPathFilter({
  include: ["*.txt"],
  exclude: ["Unihan/*"]
});

// Use preconfigured filters
const dataFilesFilter = PRECONFIGURED_FILTERS.dataFiles;

On this page