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

sls-yaml

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sls-yaml - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

40

dist/index.js

@@ -35,3 +35,3 @@ (function webpackUniversalModuleDefinition(root, factory) {

/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "6e6d96300003b090de8f";
/******/ var hotCurrentHash = "fc045e83128bac09b2ba";
/******/ var hotRequestTimeout = 10000;

@@ -1214,17 +1214,25 @@ /******/ var hotCurrentModuleData = {};

if (root === void 0) { root = {}; }
var keys = Object.keys(content);
keys.forEach(function (key) {
var value = content[key];
var node = null;
if (typeof value === "string") {
node = print(parseToken(value), basePath, key);
}
else if (typeof value === "object") {
var child = {};
value = print(parse(value, child, basePath), basePath, key);
}
var newValue = node || value;
root[key] = newValue;
selfObj[key] = newValue;
});
if (typeof content === "object") {
var keys = Object.keys(content);
keys.forEach(function (key) {
var value = content[key];
var node = null;
if (typeof value === "string") {
node = print(parseToken(value), basePath, key);
}
else if (typeof value === "object") {
var child = {};
value = print(parse(value, child, basePath), basePath, key);
}
var newValue = node || value;
root[key] = newValue;
selfObj[key] = newValue;
});
}
else if (typeof content === "string") {
return print(parseToken(content), basePath, "");
}
else {
return content;
}
return root;

@@ -1231,0 +1239,0 @@ }

2

package.json
{
"name": "sls-yaml",
"version": "1.0.2",
"version": "1.0.3",
"description": "Serverless framework yaml extension parser",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -250,17 +250,23 @@ const fs = require("fs");

function parse(content: any, root: any = {}, basePath: string) {
const keys = Object.keys(content);
keys.forEach(key => {
let value = content[key];
let node = null;
if (typeof value === "string") {
node = print(parseToken(value), basePath, key);
} else if (typeof value === "object") {
const child = {};
value = print(parse(value, child, basePath), basePath, key);
}
const newValue = node || value;
root[key] = newValue;
selfObj[key] = newValue;
});
function parse(content: any, root: any = {}, basePath: string): any {
if (typeof content === "object") {
const keys = Object.keys(content);
keys.forEach(key => {
let value = content[key];
let node = null;
if (typeof value === "string") {
node = print(parseToken(value), basePath, key);
} else if (typeof value === "object") {
const child = {};
value = print(parse(value, child, basePath), basePath, key);
}
const newValue = node || value;
root[key] = newValue;
selfObj[key] = newValue;
});
} else if (typeof content === "string") {
return print(parseToken(content), basePath, "");
} else {
return content;
}
return root;

@@ -267,0 +273,0 @@ }

@@ -19,2 +19,9 @@ import yaml from "./sls-yaml";

});
describe("When passing a file reference without key", () => {
it("Should replace value with file content", () => {
const content = Buffer.from("${file(src/__mocks__/file.yml)}");
const doc = yaml(content);
expect(doc).toEqual({ key: "value" });
});
});
describe("When passing a env reference", () => {

@@ -21,0 +28,0 @@ it("Should replace env var with it's value", () => {

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