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

arrgv

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrgv - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

90

index.js

@@ -12,74 +12,42 @@ module.exports = function(str){

for (var i=0, len=str.length; i<len; i++) {
var c = str[i];
var cc = str[i+1];
if (c == "'") {
if (sQuoted) {
sQuoted = false;
} else if (backSlash) {
buffer += c;
backSlash = false;
} else if (dQuoted) {
buffer += c;
} else {
sQuoted = true;
}
if (sQuoted && str[i] === "'") {
sQuoted = false;
continue;
}
if (c == '"') {
if (sQuoted) {
buffer += c;
} else if (backSlash) {
buffer += c;
backSlash = false;
} else if (dQuoted) {
dQuoted = false;
} else {
if (!sQuoted && !dQuoted && !backSlash) {
switch (str[i]) {
case "'":
sQuoted = true;
continue;
case '"':
dQuoted = true;
}
continue;
}
if (c == '\\') {
if (sQuoted) {
buffer += c;
} else if (backSlash) {
buffer += c;
backSlash = false;
} else if (!dQuoted) {
continue;
case '\\':
backSlash = true;
} else if (~['"', '`', '$', '\\'].indexOf(cc)) {
backSlash = true;
} else {
buffer += c;
backSlash = true;
}
continue;
}
if (~['\b', '\f', '\n', '\r', '\t', ' '].indexOf(c)) {
if (sQuoted) {
buffer += c;
} else if (backSlash) {
buffer += c;
backSlash = false;
} else if (dQuoted) {
buffer += c;
} else {
continue;
case '\b':
case '\f':
case '\n':
case '\r':
case '\t':
case ' ':
if (buffer.length) res.push(buffer);
buffer = '';
continue;
}
}
if (!sQuoted && dQuoted && !backSlash && str[i] == '"') {
dQuoted = false;
continue;
}
if (sQuoted) {
buffer += c;
} else if (backSlash) {
buffer += c;
if (!sQuoted && dQuoted && !backSlash && str[i] == '\\') {
backSlash = true;
if (['"', '`', '$', '\\'].indexOf(str[i+1]) !== -1) {
continue;
}
}
if (backSlash) {
backSlash = false;
} else if (dQuoted) {
buffer += c;
} else {
buffer += c;
}
buffer += str[i];
}

@@ -86,0 +54,0 @@ if (buffer.length) res.push(buffer);

{
"name": "arrgv",
"version": "0.0.5",
"version": "0.0.6",
"description": "Parsing string to array of args like node on bash do.",

@@ -5,0 +5,0 @@ "main": "index.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