Socket
Socket
Sign inDemoInstall

@stoplight/yaml

Package Overview
Dependencies
Maintainers
14
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoplight/yaml - npm Package Compare versions

Comparing version 2.5.1 to 2.6.0

14

getLocationForJsonPath.js

@@ -9,5 +9,8 @@ "use strict";

return;
return getLoc(lineMap, { start: getStartPosition(node), end: getEndPosition(node) });
return getLoc(lineMap, {
start: getStartPosition(node, lineMap.length > 0 ? lineMap[0] : 0),
end: getEndPosition(node),
});
};
function getStartPosition(node) {
function getStartPosition(node, offset) {
if (node.parent && node.parent.kind === yaml_ast_parser_1.Kind.MAPPING) {

@@ -21,2 +24,5 @@ if (node.parent.value === null) {

}
if (node.parent === null && offset - node.startPosition === 0) {
return 0;
}
return node.startPosition;

@@ -28,3 +34,3 @@ }

const { items } = node;
if (items.length !== 0) {
if (items.length !== 0 && items[items.length - 1] !== null) {
return getEndPosition(items[items.length - 1]);

@@ -44,3 +50,3 @@ }

case yaml_ast_parser_1.Kind.SCALAR:
if (node.parent.kind === yaml_ast_parser_1.Kind.MAPPING && node.parent.value === null) {
if (node.parent !== null && node.parent.kind === yaml_ast_parser_1.Kind.MAPPING && node.parent.value === null) {
return node.parent.endPosition;

@@ -47,0 +53,0 @@ }

{
"name": "@stoplight/yaml",
"version": "2.5.1",
"version": "2.6.0",
"description": "Useful functions when working with YAML.",

@@ -5,0 +5,0 @@ "keywords": [

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