Legacy CommonJS YAML Parser

0.0.2 · abandoned · verified Sun Apr 19

The `yamlparser` package is an extremely old and unmaintained JavaScript YAML parser, last published in May 2013 with its only version being 0.0.2. It was created as a CommonJS port of an earlier client-side JavaScript YAML parser and aims to handle 'simply structured YAML files' rather than fully implementing the YAML specification. The package's GitHub repository was archived in December 2022, officially marking it as read-only and abandoned. Due to its age, lack of updates, and limited feature set, it is not suitable for modern applications. Users requiring YAML parsing functionality should consider actively maintained alternatives like `js-yaml` or `yaml` that support current YAML specifications and modern JavaScript environments (ESM).

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to import the `yamlparser` module using CommonJS `require` and parse a simple YAML string. Note the lack of error handling guarantees for malformed YAML due to limited spec support and undocumented API.

const yamlparser = require('yamlparser');

const yamlString = `
name: John Doe
age: 30
cities:
  - New York
  - London
active: true
`;

try {
  const data = yamlparser.parse(yamlString);
  console.log('Parsed YAML:', data);
  // Expected output: { name: 'John Doe', age: 30, cities: [ 'New York', 'London' ], active: true }
} catch (error) {
  console.error('Failed to parse YAML:', error.message);
}

// Example with invalid YAML (may throw an error or produce unexpected results depending on implementation)
const invalidYamlString = `
key: value
  another_key: indented_incorrectly
`;
try {
  const invalidData = yamlparser.parse(invalidYamlString);
  console.log('Parsed invalid YAML:', invalidData);
} catch (error) {
  console.error('Failed to parse invalid YAML as expected:', error.message);
}

view raw JSON →