Socket
Socket
Sign inDemoInstall

@mongosh/js-multiline-to-singleline

Package Overview
Dependencies
1
Maintainers
10
Versions
55
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.6.1

21

lib/index.js

@@ -60,2 +60,21 @@ "use strict";

}
function multilineTemplateStringToSingleLine({ types: t }) {
return {
visitor: {
TemplateLiteral(path) {
var _a, _b;
if (!path.node.quasis.some(({ value }) => value.raw.match(/[\r\n]/))) {
return;
}
if (path.parentPath.isTaggedTemplateExpression()) {
path.parentPath.replaceWith(t.callExpression(t.identifier('eval'), [t.stringLiteral(this.file.code.slice((_a = path.parent.start) !== null && _a !== void 0 ? _a : undefined, (_b = path.parent.end) !== null && _b !== void 0 ? _b : undefined))]));
return;
}
path.replaceWith(t.templateLiteral(path.node.quasis.map(el => t.templateElement({
raw: el.value.raw.replace(/\n|\r\n?/g, '\\n')
}, el.tail)), path.node.expressions));
}
}
};
}
function makeMultilineJSIntoSingleLine(src) {

@@ -73,3 +92,3 @@ var _a, _b;

browserslistConfigFile: false,
plugins: [lineCommentToBlockComment],
plugins: [lineCommentToBlockComment, multilineTemplateStringToSingleLine],
sourceType: 'script'

@@ -76,0 +95,0 @@ })) === null || _a === void 0 ? void 0 : _a.code) !== null && _b !== void 0 ? _b : src;

4

package.json
{
"name": "@mongosh/js-multiline-to-singleline",
"version": "1.6.0",
"version": "1.6.1",
"description": "Make multiline JS into a single line",

@@ -37,3 +37,3 @@ "main": "./lib/index.js",

},
"gitHead": "fbbf54a08fb315ae5fde693a98d439b9aa3285f8"
"gitHead": "51c067456d3e0127156ef1722a44659151e01a12"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc