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

parse-static-imports

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-static-imports - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

9

dist/importLike.js

@@ -10,9 +10,10 @@ "use strict";

const importIdx = str.indexOf("import");
const quoteIdx = str.replace(/(\'|\`)+/gm, '"').indexOf('"'); // eslint-disable-line no-useless-escape
const normalized = str.replace(/(\'|\`)+/gm, '"'); // eslint-disable-line no-useless-escape
const semiColonIdx = str.indexOf(";");
const startQuoteIdx = normalized.indexOf('"');
const endQuoteIdx = normalized.indexOf('"', startQuoteIdx + 1);
const startIdx = importIdx >= 0 ? importIdx + 6 : 0;
const betweenImportAndQuote = str.substring(startIdx, quoteIdx).trim();
const sideEffectOnly = semiColonIdx >= 0 && betweenImportAndQuote.length === 0;
const betweenImportAndQuote = str.substring(startIdx, startQuoteIdx).trim();
const sideEffectOnly = startQuoteIdx >= 0 && endQuoteIdx >= 0 && betweenImportAndQuote.length === 0;
return str.includes("from") || sideEffectOnly;
}

@@ -12,10 +12,10 @@ "use strict";

const importIdx = normalized.indexOf("import");
const quoteIdx = normalized.indexOf('"');
const semiColonIdx = normalized.indexOf(";");
const startQuoteIdx = normalized.indexOf('"');
const endQuoteIdx = normalized.indexOf('"', startQuoteIdx + 1);
if (importIdx < 0 || semiColonIdx < 0 || quoteIdx < 0) {
if (importIdx < 0 || startQuoteIdx < 0 || endQuoteIdx < 0) {
return "";
}
return normalized.substring(quoteIdx, semiColonIdx).replace(/(\;|\"|\s)+/gm, ""); // eslint-disable-line no-useless-escape
return normalized.substring(startQuoteIdx, endQuoteIdx).replace(/(\"|\s)+/gm, ""); // eslint-disable-line no-useless-escape
}
{
"name": "parse-static-imports",
"description": "Gracefully parse ECMAScript static imports 💃",
"version": "1.0.3",
"version": "1.0.4",
"author": "Cody A Price <dev.cprice@gmail.com>",

@@ -6,0 +6,0 @@ "bugs": {

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