You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

yaml-js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaml-js

Pure Javascript YAML loader and dumper, ported from PyYAML

0.3.1
latest
Source
npmnpm
Version published
Weekly downloads
218K
3.7%
Maintainers
1
Weekly downloads
 
Created

What is yaml-js?

The yaml-js npm package is a JavaScript library for parsing and stringifying YAML (YAML Ain't Markup Language) data. It allows developers to easily convert YAML data to JavaScript objects and vice versa, making it useful for configuration files, data serialization, and more.

What are yaml-js's main functionalities?

Parsing YAML to JavaScript Object

This feature allows you to parse a YAML string and convert it into a JavaScript object. The `load` method is used to achieve this.

const yaml = require('yaml-js');
const yamlString = 'name: John Doe\nage: 30';
const jsObject = yaml.load(yamlString);
console.log(jsObject);

Stringifying JavaScript Object to YAML

This feature allows you to convert a JavaScript object into a YAML string. The `dump` method is used to achieve this.

const yaml = require('yaml-js');
const jsObject = { name: 'John Doe', age: 30 };
const yamlString = yaml.dump(jsObject);
console.log(yamlString);

Other packages similar to yaml-js

FAQs

Package last updated on 19 Sep 2021

Did you know?

Socket

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