Skip to content

S-tier S-Expression serialization & deserialization for JavaScript powered by OCaml 🐫✨

Notifications You must be signed in to change notification settings

dmmulroy/s-tier

Repository files navigation

the most s-tier logo of all time

The s-tier npm library for s-expression serialization and deserialization.

Start using S-Tier today with npm install s-tier

About S-Tier

S-Tier is a library in the npm ecosystem for efficient and extensive serialization and deserialization of s-expressions. It's unique in offering both standard and canonical s-expression (de)serialization, making it an indispensable tool for developers working with these formats.

At its heart, S-Tier leverages the power of sexplib and csexp, two renowned libraries from the OCaml ecosystem, compiled into JavaScript using Melange. This synergy brings unparalleled speed and reliability to JavaScript and TypeScript developers.

Features

S-Tier offers:
  • Extensive s-expression serialization/deserialization: Handle complex s-expressions with ease.
  • Canonical s-expression support: The only npm library offering this feature.
  • High performance: Thanks to its OCaml roots and efficient Melange compilation.
  • Ease of use: Designed with a straightforward API for quick integration into your projects.

Usage Examples

const STier = require("s-tier");

// Example deserialization
let deserialized = STier.Canonical.deserialize(
  "(10:methodName9:initalize(11:duneVersion4:3.13)(15:protocolVersion5:0.0.1))",
);

// Example serialization
let serialized = STier.serialize(deserialized);
/**
 * (methodName initalize
 *   (duneVersion 3.13)
 *   (protocolVersion 0.0.1))
 */