Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

yaml-ast-parser-custom-tags

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaml-ast-parser-custom-tags

This is a custom maintained fork specifically for the YAML Language server.

  • 0.0.43
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.8K
decreased by-42.61%
Maintainers
1
Weekly downloads
 
Created
Source

This is a custom maintained fork specifically for the YAML Language server.

The ONLY goal of this fork is to extend the custom tags of YAML-AST-PARSER so that custom tags can have multiple types.

If you are looking for the main YAML-AST-PARSER project you can find that here

Changes in the project: - src/loader.ts - added additionalKinds field - test/multipleKinds.test.ts - added tests for additionalKinds field - README.md

yaml-ast-parser

Build Status

This is a fork of JS-YAML which supports parsing of YAML into AST.

In additional to parsing YAML to AST, it has following features:

  • restoration after the errors and reporting errors as a part of AST nodes.
  • built-in support for !include tag used in RAML

Usage

The type information below is relevant when using TypeScript, if using from JavaScript only the field/method information is relevant.

load method can be used to load the tree and returns a YAMLNode.

YAMLNode

YAMLNode class is an ancestor for all node kinds. It's kind field determine node kind, one of Kind enum:

  • SCALAR, MAPPING, MAP, SEQ, ANCHOR_REF or INCLUDE_REF.

After node kind is determined, it can be cast to one of the YAMLNode descendants types:

  • YAMLScalar, YAMLMapping, YamlMap, YAMLSequence or YAMLAnchorReference.
classimportant members
YAMLNodestartPosition and endPosition provide node range.
YAMLScalarstring value field
YAMLMappingYAMLScalar key and YAMLNode value fields
YAMLSequenceYAMLNode[] items field
YamlMapYAMLMapping[] mappings field
YAMLAnchorReferencestring referencesAnchor and YAMLNode value

YAMLScalar

Scalars are one of the three main node types defined by YAML and are effectively leaf nodes.

There are many factors that can influence the type of datum represent in scalar node (context, schema, tag, etc.).

To help inspection of a YAMLScalar to determine its datatype when a document uses the Core Schema, you can pass the YAMLScalar to the determineScalarType function. It will return an enum value indicating null, bool, int, float, or string.

Once you know the type, there are also some helper functions to help read the value by passing them the string, value: parseYamlBoolean, parseYamlFloat, and parseYamlInteger.

Keywords

FAQs

Package last updated on 06 Mar 2019

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc