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

@opencharts/normalizer

v0.0.1

Published

Versioned transform registry and built-in normalizers for OpenCharts

Readme

@opencharts/normalizer

Versioned transform registry and built-in normalizer functions for OpenCharts.

npm License: MIT

Overview

@opencharts/normalizer provides:

  • CanonicalNormalizerRegistry — a versioned store of named transform functions. Normalizers are referenced by { name, version } from mapping bindings.
  • registerBuiltinNormalizers — registers the built-in transform set (string, date, gender, collection, crosswalk, regex, hashing normalizers).

All normalizers are pure functions: same input always yields the same output. No I/O, no side effects, no global state.

Installation

npm install @opencharts/normalizer

Usage

With the SDK

import { createCanonicalSystem } from '@opencharts/sdk';

// Built-in normalizers are registered automatically
const { normalizers } = createCanonicalSystem();

const trimFn = normalizers.get('trim', 1);
console.log(trimFn('  hello  ')); // 'hello'

Manual setup

import {
  CanonicalNormalizerRegistry,
  registerBuiltinNormalizers,
} from '@opencharts/normalizer';

const normalizers = new CanonicalNormalizerRegistry();
registerBuiltinNormalizers(normalizers);

Register a custom normalizer

normalizers.register('parse_npi', 1, (value) => {
  if (typeof value !== 'string') return null;
  const cleaned = value.replace(/\D/g, '');
  return cleaned.length === 10 ? cleaned : null;
});

Apply a transform chain

// Apply multiple transforms in sequence
const result = normalizers.apply('  718-7  ', [
  { name: 'trim', version: 1 },
  { name: 'uppercase', version: 1 },
]);
console.log(result); // '718-7'

Built-in Normalizers

String transforms

| Name | Version | Description | |---|---|---| | trim | 1 | String.prototype.trim() | | uppercase | 1 | String.prototype.toUpperCase() | | lowercase | 1 | String.prototype.toLowerCase() | | normalize_identifier_system | 1 | Trim + lowercase (for system URIs) | | normalize_status | 1 | Trim + lowercase + replace spaces with - |

Date transforms

| Name | Version | Description | |---|---|---| | to_iso_date | 1 | Converts YYYYMMDD, M/D/YYYY, MM/DD/YYYY, ISO → YYYY-MM-DD | | to_iso_datetime | 1 | Converts any parseable datetime → ISO 8601 with timezone |

Gender transform

| Name | Version | Description | |---|---|---| | to_fhir_administrative_gender | 1 | Maps m/male/f/female/o/other/u/unknown → FHIR gender |

Collection transforms

| Name | Version | Description | |---|---|---| | to_array | 1 | Wraps non-array in [value]; null → [] | | remove_empty | 1 | Filters null and empty strings from an array | | flatten | 1 | Flattens nested arrays; options: { depth } | | split | 1 | Splits a delimited string; options: { delimiter, trim, keepEmpty } | | delimited | 1 | Splits "v1\|s1, v2\|s2" into [{value,system}]; options: { item, pair, fields } | | map_values | 1 | Crosswalk lookup; options: { table, default, passthrough } | | regex_extract | 1 | Extracts capture groups; options: { pattern, flags, format, default } |

Canonical / hashing transforms

| Name | Version | Description | |---|---|---| | sort_canonical | 1 | Recursively sorts object keys for a deterministic representation | | compact_hash | 1 | Stable 32-bit string hash of the canonical JSON |

API Reference

CanonicalNormalizerRegistry

| Method | Description | |---|---| | register(name, version, fn) | Register fn(value, options?) => result; each name+version is unique | | get(name, version) | Returns the function; throws if not registered | | has(name, version) | Returns boolean | | apply(value, chain) | Applies [{ name, version }] transforms in sequence | | list() | Returns all registered "name::version" keys |

License

MIT