Skip to content

traversable/schema

Repository files navigation


ᯓ𝘁𝗿𝗮𝘃𝗲𝗿𝘀𝗮𝗯𝗹𝗲/𝘀𝗰𝗵𝗲𝗺𝗮


TypeScript schema rewriter

TypeScript   License   Documentation  
Tree-shakable   ESM Supported   CJS Supported   npm  


Overview

@traversable/schema is a general purpose schema rewriting tool.

At the time of writing, it is home to the fastest deep equal and fastest deep clone functions in the JavaScript ecosystem.

You can learn more about why they're so fast, and how the benchmarks were conducted, below:

Design

A schema is a syntax tree. ASTs lend themselves to (re)-interpretation. If you're not treating your TypeScript schemas like ASTs, you're missing out.

@traversable/schema makes it easy to do anything with a TypeScript schema.

What's a "schema rewriter"?

The idea of term rewriting comes from the programming language community. Languages like Racket and Lean invert control and give users a first-class API for rewriting and extending the language.

Unfortunately, we don't have that kind of power in TypeScript because we're limited by the target language (JavaScript). And frankly, given how flexible JavaScript already is, exposing that kind of API would be a recipe for disaster.

We do however have schemas, and schemas are basically ASTs.

Integrations

Libraries