Socket
Socket
Sign inDemoInstall

yaml

Package Overview
Dependencies
0
Maintainers
3
Versions
85
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yaml

JavaScript parser and stringifier for YAML 1.2


Version published
Maintainers
3
Install size
193 kB
Created

Package description

What is yaml?

The 'yaml' npm package is a JavaScript library for parsing and serializing YAML, a human-friendly data serialization standard. It can be used to convert YAML to JSON and vice versa, and to work with YAML content programmatically in JavaScript.

What are yaml's main functionalities?

Parsing YAML to JSON

This feature allows you to parse a string of YAML content and convert it into a JavaScript object.

const yaml = require('yaml');
const yamlText = 'key: value\nnumber: 123';
const jsonObject = yaml.parse(yamlText);
console.log(jsonObject);

Stringifying JSON to YAML

This feature enables you to take a JavaScript object and serialize it into a YAML formatted string.

const yaml = require('yaml');
const jsonObject = { key: 'value', number: 123 };
const yamlText = yaml.stringify(jsonObject);
console.log(yamlText);

Custom Tags

This feature allows you to define custom tags for specialized YAML types, enabling the parsing of YAML content with custom data structures.

const yaml = require('yaml');
const customType = { identify: value => value instanceof Set, tag: 'tag:yaml.org,2002:set', resolve: (doc, cst) => new Set(cst.strValue.split(', ')) };
yaml.defaultOptions.customTags = [customType];
const yamlText = '!!set a, b, c';
const data = yaml.parse(yamlText);
console.log(data);

Other packages similar to yaml

Readme

Source

YAML

JavaScript parser and stringifier for YAML 1.2. See the project's documentation site for more information.

Note: yaml 0.x and 1.x are rather different implementations. For the earlier yaml, see tj/js-yaml.

Keywords

FAQs

Last updated on 18 Jun 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc