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

@origints/yaml

v0.3.2

Published

YAML parsing for Origins with anchor/alias/tag preservation.

Downloads

51

Readme

@origints/yaml

YAML parsing for Origins with anchor/alias/tag preservation and full lineage tracking.


Features

  • Parse single or multi-document YAML streams
  • Preserve anchors, aliases, and custom tags
  • Full source location tracking for every node
  • Navigation API with type-safe extraction
  • JSON conversion with customizable options
  • Integrates with Origins transform registry

Installation

npm install @origints/yaml @origints/core

Usage with Planner

Extract values from a YAML config file

import { Planner, loadFile, run } from '@origints/core'
import { parseYaml } from '@origints/yaml'

const plan = new Planner()
  .in(loadFile('config.yaml'))
  .mapIn(parseYaml())
  .emit((out, $) =>
    out
      .add('host', $.get('database').get('host').string())
      .add('port', $.get('database').get('port').number())
  )
  .compile()

const result = await run(plan, { readFile, registry })
// result.value: { host: 'localhost', port: 5432 }

Extract nested structures

// config.yaml:
// app:
//   name: MyApp
//   settings:
//     theme: dark
//     language: en

const plan = new Planner()
  .in(loadFile('config.yaml'))
  .mapIn(parseYaml())
  .emit((out, $) =>
    out
      .add('appName', $.get('app').get('name').string())
      .add('theme', $.get('app').get('settings').get('theme').string())
      .add('lang', $.get('app').get('settings').get('language').string())
  )
  .compile()

Extract arrays

// users.yaml:
// users:
//   - name: Alice
//     role: admin
//   - name: Bob
//     role: user

const plan = new Planner()
  .in(loadFile('users.yaml'))
  .mapIn(parseYaml())
  .emit((out, $) =>
    out
      .add(
        'names',
        $.get('users').array(u => u.get('name').string())
      )
      .add(
        'roles',
        $.get('users').array(u => u.get('role').string())
      )
  )
  .compile()

const result = await run(plan, { readFile, registry })
// result.value: { names: ['Alice', 'Bob'], roles: ['admin', 'user'] }

Convenience collection methods

For simple sequences of scalars, use strings() or numbers() instead of array():

// config.yaml:
// tags:
//   - dev
//   - staging
//   - prod
// ports:
//   - 3000
//   - 3001
//   - 3002

const plan = new Planner()
  .in(loadFile('config.yaml'))
  .mapIn(parseYaml())
  .emit((out, $) =>
    out
      .add('tags', $.get('tags').strings())
      .add('ports', $.get('ports').numbers())
  )
  .compile()

const result = await run(plan, { readFile, registry })
// result.value: { tags: ['dev', 'staging', 'prod'], ports: [3000, 3001, 3002] }

Multi-document YAML

import { parseYamlAll } from '@origints/yaml'

const plan = new Planner()
  .in(loadFile('multi.yaml'))
  .mapIn(parseYamlAll())
  .emit((out, $) =>
    out.add(
      'names',
      $.array(doc => doc.get('name').string())
    )
  )
  .compile()

Combine YAML with other sources

const plan = new Planner()
  .in(loadFile('defaults.yaml'))
  .mapIn(parseYaml())
  .emit((out, $) =>
    out.add('host', $.get('host').string()).add('port', $.get('port').number())
  )
  .in(loadFile('overrides.yaml'))
  .mapIn(parseYaml())
  .emit((out, $) => out.addIfEmpty('host', $.get('host').string()))
  .compile()

Standalone usage (without Planner)

import { parseYamlImpl, toJson, YamlNode } from '@origints/yaml'

const node = parseYamlImpl.execute(yamlString) as YamlNode

// Navigate with Result types
const name = node.get('name')
if (name.ok) {
  console.log(name.value.asString().value)
}

// Or convert to JSON
const json = toJson(node)
if (json.ok) {
  console.log(json.value)
}

API

| Export | Description | | ---------------------------------- | ------------------------------------------------- | | parseYaml(options?) | Create a transform AST for single-document YAML | | parseYamlAll(options?) | Create a transform AST for multi-document YAML | | parseYamlImpl | Sync transform implementation (string input) | | parseYamlAsyncImpl | Async transform implementation (string or stream) | | parseYamlAllImpl | Async multi-document implementation | | registerYamlTransforms(registry) | Register all YAML transforms with a registry | | YamlNode | Navigable wrapper around parsed YAML | | toJson(node, options?) | Convert YamlNode to JSON | | toJsonValue(node) | Convert YamlNode to JSON with defaults | | ok, fail, formatYamlPath | Result helpers |


License

MIT