Socket
Socket
Sign inDemoInstall

@stoplight/yaml

Package Overview
Dependencies
Maintainers
27
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 3.7.1 to 3.8.0

3

package.json
{
"name": "@stoplight/yaml",
"version": "3.7.1",
"version": "3.8.0",
"description": "Useful functions when working with YAML.",

@@ -27,2 +27,3 @@ "keywords": [

"dependencies": {
"@stoplight/ordered-object-literal": "^1.0.0",
"@stoplight/types": "^11.1.1",

@@ -29,0 +30,0 @@ "@stoplight/yaml-ast-parser": "0.0.45",

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ordered_object_literal_1 = require("@stoplight/ordered-object-literal");
const types_1 = require("@stoplight/types");

@@ -8,3 +9,2 @@ const yaml_ast_parser_1 = require("@stoplight/yaml-ast-parser");

const lineForPosition_1 = require("./lineForPosition");
const trapAccess_1 = require("./trapAccess");
const types_2 = require("./types");

@@ -65,7 +65,2 @@ const utils_1 = require("./utils");

const reduced = reduceMergeKeys(exports.walkAST(mapping.value, options, lineMap, diagnostics), preserveKeyOrder);
if (preserveKeyOrder && reduced !== null) {
for (const reducedKey of Object.keys(reduced)) {
pushKey(container, reducedKey);
}
}
Object.assign(container, reduced);

@@ -80,5 +75,2 @@ }

}
if (trapAccess_1.KEYS in container) {
container[trapAccess_1.KEYS].push(trapAccess_1.KEYS);
}
return container;

@@ -160,11 +152,9 @@ }

const keys = Object.keys(item);
Object.assign(merged, item);
for (let i = keys.length - 1; i >= 0; i--) {
unshiftKey(merged, keys[i]);
}
return Object.assign(merged, item);
return merged;
}
: (merged, item) => Object.assign(merged, item), createMapContainer(preserveKeyOrder));
if (preserveKeyOrder) {
reduced[trapAccess_1.KEYS].push(trapAccess_1.KEYS);
}
return reduced;

@@ -175,15 +165,11 @@ }

function createMapContainer(preserveKeyOrder) {
if (preserveKeyOrder) {
const container = trapAccess_1.trapAccess({});
Reflect.defineProperty(container, trapAccess_1.KEYS, {
value: [],
});
return container;
}
return {};
return preserveKeyOrder ? ordered_object_literal_1.default({}) : {};
}
function deleteKey(container, key) {
const index = key in container ? container[trapAccess_1.KEYS].indexOf(key) : -1;
if (!(key in container))
return;
const order = ordered_object_literal_1.getOrder(container);
const index = order.indexOf(key);
if (index !== -1) {
container[trapAccess_1.KEYS].splice(index, 1);
order.splice(index, 1);
}

@@ -193,7 +179,7 @@ }

deleteKey(container, key);
container[trapAccess_1.KEYS].unshift(key);
ordered_object_literal_1.getOrder(container).unshift(key);
}
function pushKey(container, key) {
deleteKey(container, key);
container[trapAccess_1.KEYS].push(key);
ordered_object_literal_1.getOrder(container).push(key);
}

@@ -200,0 +186,0 @@ function validateMappingKey(mapping, lineMap, diagnostics, yamlMode) {

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.KEYS = Symbol('object_keys');
const ordered_object_literal_1 = require("@stoplight/ordered-object-literal");
exports.KEYS = Symbol.for(ordered_object_literal_1.ORDER_KEY_ID);
const traps = {

@@ -5,0 +6,0 @@ ownKeys(target) {

Sorry, the diff of this file is not supported yet

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