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

@aiblox/xform

v0.1.0

Published

Context optimization engine for LLM-ready structured data

Readme

@aiblox/xform

Context optimization engine for LLM-ready structured data. Converts JSON, XML, CSV, and TSV into compact, high-signal output formats.

This is not a general file-format library — it scans, reduces, transforms, and describes data specifically for AI context windows.

Install

npm install @aiblox/xform

Quick start

import { xform } from '@aiblox/xform';

const largeJsonData = [
  { id: 1, tenant: 'acme', name: 'Ada', status: 'active', note: null },
  { id: 2, tenant: 'acme', name: 'Bob', status: 'active', note: null },
  ...
];

const context = await xform(largeJsonData);

Sample output:

Dataset with {X} records and {Y} columns.
Constant across all records: status="active"; tenant="acme".

Records:
  [X|]{id|name|region|score}:
    1|Ada|us-east|10
    2|Bob|us-east|12
    3|Cora|eu-west|99
    ...

xform is an alias for transform. See USAGE.md for examples of every output format with sample inputs and outputs.

API

| Function | Description | |----------|-------------| | xform(input, options) | Alias for transform — full pipeline → context, json_compact, or toon | | transform(input, options) | Full pipeline → context, json_compact, or toon | | scan(input, options) | Column profiles, types, constants, null ratios | | reduce(input, options) | Remove null-only columns, collapse constants | | describe(input, options) | Concise natural-language data summary | | toJsonCompact(input, options) | Minified JSON with metadata | | toToon(input, options) | TOON-encoded output (tabular-friendly) | | toDSV(data, delimiter) | Delimiter-separated values (records or pipeline result) | | toCSV / toTSV / toPSV | toDSV with ,, tab, or pipe delimiters | | fromJson / fromXml / fromCsv / fromTsv | Parse inputs to record arrays |

Options

interface TransformOptions {
  output?: 'context' | 'json_compact' | 'toon';
  /** TOON field separator: `|`, `,`, tab, or `pipe` / `comma` / `tab`. Default `|`. */
  delimiter?: string;
  schema?: SchemaDefinition[];
  hints?: { groupby?: string[] };
  compact?: boolean;
  preserveOutliers?: boolean;
  includeStats?: boolean;
  format?: 'json' | 'xml' | 'csv' | 'tsv';
}

Schema

Schemas are JSON arrays with name, optional _extends, and nested _type:

const schemas = [
  { name: 'Base', status: 'string' },
  { name: 'User', _extends: 'Base', email: 'string' },
];

await transform(records, { schema: schemas });

Grouping

Record grouping runs only when you pass explicit hints — no fuzzy clustering by default:

await transform(records, {
  hints: { groupby: ['department'] },
});

Pipeline

  1. Scan — column types, null ratios, cheap constant detection
  2. Reduce — drop null-only columns, collapse constants, summarize repeats
  3. Transform — schema-aware normalization
  4. Describe — token-efficient natural language summary

If the final output is longer than the serialized input, results automatically fall back to the original (token safety). Disable with fallbackToOriginal: false.

License

MIT