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

yaml-ast-parser

Package Overview
Dependencies
Maintainers
2
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yaml-ast-parser - npm Package Compare versions

Comparing version 0.0.28 to 0.0.29

19

dist/loader.js

@@ -253,15 +253,10 @@ "use strict";

}
if ('tag:yaml.org,2002:merge' === keyTag) {
throw new Error("Should not happen");
var mapping = ast.newMapping(keyNode, valueNode);
mapping.parent = _result;
keyNode.parent = mapping;
if (valueNode != null) {
valueNode.parent = mapping;
}
else {
var mapping = ast.newMapping(keyNode, valueNode);
mapping.parent = _result;
keyNode.parent = mapping;
if (valueNode != null) {
valueNode.parent = mapping;
}
_result.mappings.push(mapping);
_result.endPosition = valueNode ? valueNode.endPosition : keyNode.endPosition + 1;
}
_result.mappings.push(mapping);
_result.endPosition = valueNode ? valueNode.endPosition : keyNode.endPosition + 1;
return _result;

@@ -268,0 +263,0 @@ }

{
"name": "yaml-ast-parser",
"version": "0.0.28",
"version": "0.0.29",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -11,1 +11,22 @@ # yaml-ast-parser

* built-in support for `!include` tag used in RAML
`load` method can be used to load the tree and returns `YAMLNode` root.
`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 casted to one of the `YAMLNode` descendants: `YAMLScalar`, `YAMLMapping`, `YamlMap`, `YAMLSequence` or `YAMLAnchorReference`.
`startPosition` and `endPosition` of `YAMLNode` class provide node range.
`YAMLScalar` has string `value` field.
`YAMLMapping` has `YAMLScalar` `key` and `YAMLNode` `value` fields.
`YAMLSequence` has `YAMLNode[]` `items` field.
`YamlMap` has `YAMLMapping[]` `mappings` field.
`YAMLAnchorReference` has string `referencesAnchor` and `YAMLNode` `value`.

@@ -336,3 +336,4 @@ import ast=require("./yamlAST")

function storeMappingPair(state:State, _result:ast.YamlMap, keyTag, keyNode:ast.YAMLNode, valueNode:ast.YAMLNode):ast.YamlMap {
function storeMappingPair(state:State, _result:ast.YamlMap, keyTag, keyNode:ast.YAMLNode,
valueNode:ast.YAMLNode):ast.YamlMap {
var index, quantity;

@@ -353,12 +354,11 @@ if (keyNode==null){

if ('tag:yaml.org,2002:merge' === keyTag) {
throw new Error("Should not happen")//TODO LOOK IN IT
//if (Array.isArray(valueNode)) {
// for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
// mergeMappings(state, _result, valueNode[index]);
// }
//} else {
// mergeMappings(state, _result, valueNode);
//}
} else {
// if ('tag:yaml.org,2002:merge' === keyTag) {
// if (Array.isArray(valueNode)) {
// for (index = 0, quantity = (<any>valueNode).length; index < quantity; index += 1) {
// mergeMappings(state, _result, valueNode[index]);
// }
// } else {
// mergeMappings(state, _result, valueNode);
// }
// } else {

@@ -373,3 +373,3 @@ var mapping=ast.newMapping(<ast.YAMLScalar>keyNode,valueNode);

_result.endPosition=valueNode? valueNode.endPosition : keyNode.endPosition+1; //FIXME.workaround should be position of ':' indeed
}
// }

@@ -376,0 +376,0 @@ return _result;

Sorry, the diff of this file is not supported yet

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