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

lambda-serverless-api

Package Overview
Dependencies
Maintainers
1
Versions
396
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-serverless-api - npm Package Compare versions

Comparing version 1.10.2 to 1.10.3

33

lib/util/yaml.js

@@ -8,21 +8,18 @@ const fs = require("fs");

const loadRecursive = (dir, data, vars) => {
Object.keys(data).forEach((key) => {
let entry = get(data, key);
if (typeof entry === 'string' || entry instanceof String) {
// replace yaml variables with defaults
entry = entry.replace(/\${opt:([a-zA-Z0-9]+?)(?:, ["']([a-zA-Z0-9]+?)["'])?}/g, (_, k, v) => get(vars, k, v));
// load referenced yaml file
const match = /^\${file\((~?[a-zA-Z0-9._\-/]+?)\)(?::([a-zA-Z0-9.]+?))?}$/g.exec(entry);
if (match) {
const filePath = path.join(dir, match[1]);
const loaded = yaml.safeLoad(fs.readFileSync(filePath, 'utf8'));
entry = loadRecursive(dir, match[2] ? get(loaded, match[2]) : loaded, vars);
}
let result = data;
if (typeof result === 'string' || result instanceof String) {
// replace yaml variables with defaults
result = result.replace(/\${opt:([a-zA-Z0-9]+?)(?:, ["']([a-zA-Z0-9]+?)["'])?}/g, (_, k, v) => get(vars, k, v));
// load referenced yaml file
const match = /^\${file\((~?[a-zA-Z0-9._\-/]+?)\)(?::([a-zA-Z0-9.]+?))?}$/g.exec(result);
if (match) {
const filePath = path.join(dir, match[1]);
const loaded = yaml.safeLoad(fs.readFileSync(filePath, 'utf8'));
result = loadRecursive(dir, match[2] ? get(loaded, match[2]) : loaded, vars);
}
if (entry instanceof Object) {
entry = loadRecursive(dir, entry, vars);
}
set(data, key, entry);
});
return data;
}
if (result instanceof Object) {
Object.keys(result).forEach(key => set(result, key, loadRecursive(dir, get(result, key), vars)));
}
return result;
};

@@ -29,0 +26,0 @@

@@ -23,3 +23,3 @@ {

},
"version": "1.10.2",
"version": "1.10.3",
"scripts": {

@@ -26,0 +26,0 @@ "test": "grunt gardener",

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