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

evaldown

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

evaldown - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

24

lib/md/evaluateSnippets.js

@@ -61,2 +61,11 @@ const vm = require("vm");

const code = prepareCodeForParsing(snippet, flags);
if (code) {
return rewriteSource(code);
} else {
return "";
}
}
function prepareCodeForParsing(snippet, flags) {
const { code } = snippet;

@@ -66,5 +75,5 @@ if (!code) {

} else if (flags.async) {
return rewriteSource(`(async function () {${code}})();`);
return `(async function () {\n${code}\n})();`;
} else {
return rewriteSource(`(function () {${code}})();`);
return `(function () {\n${code}\n})();`;
}

@@ -139,6 +148,2 @@ }

removeExtraneousGlobals(global, globalsToReplace);
for (const key of Object.keys(globalsToReplace)) {
global[key] = globalsToReplace[key];
}
} else if (flags.persist) {

@@ -152,2 +157,6 @@ const persistGlobals = recordExtraneousGlobals(

}
for (const key of Object.keys(globalsToReplace)) {
global[key] = globalsToReplace[key];
}
};

@@ -295,4 +304,7 @@ }

module.exports.evaluateSnippet = evaluateSnippet;
module.exports.prepareCode = function prepareCode(snippet, flags) {
return prepareCodeForParsing(snippet, flags);
};
module.exports.prepareFlags = function prepareFlags(snippet, options) {
return prepareFlagsForExecution(options.capture, snippet);
};

@@ -5,3 +5,3 @@ const findUp = require("find-up");

const canEvaluate = require("./canEvaluate");
const { prepareFlags } = require("./evaluateSnippets");
const { prepareCode, prepareFlags } = require("./evaluateSnippets");
const resolve = require("../resolve");

@@ -50,9 +50,3 @@

const flags = prepareFlags(snippet, options);
if (flags.async) {
return `(async function () {${snippet.code}})();`;
} else if (flags.return) {
return `(function () {${snippet.code}})();`;
} else {
return snippet.code;
}
return prepareCode(snippet, flags);
});

@@ -59,0 +53,0 @@

{
"name": "evaldown",
"version": "1.0.0",
"version": "1.0.1",
"description": "Evalute JavaScript snippets in markdown files and output static pages.",

@@ -5,0 +5,0 @@ "main": "lib/Evaldown.js",

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