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 1.0.1 to 1.0.2

11

index.js

@@ -9,2 +9,3 @@ module.exports = str => {

let backSlash = false;
let notEmpty = false;
let buffer = '';

@@ -15,2 +16,3 @@

sQuoted = false;
notEmpty = true;
return;

@@ -32,4 +34,5 @@ }

if(['\b', '\f', '\n', '\r', '\t', ' '].includes(v)){
if(buffer.length > 0){
if(buffer.length > 0 || notEmpty){
res.push(buffer);
notEmpty = false;
}

@@ -42,2 +45,3 @@ buffer = '';

dQuoted = false;
notEmpty = true;
return;

@@ -57,3 +61,6 @@ }

if(buffer.length > 0) res.push(buffer);
if(buffer.length > 0 || notEmpty){
res.push(buffer);
notEmpty = false;
}
if(dQuoted) throw new SyntaxError('unexpected end of string while looking for matching double quote');

@@ -60,0 +67,0 @@ if(sQuoted) throw new SyntaxError('unexpected end of string while looking for matching single quote');

2

package.json
{
"name": "arrgv",
"version": "1.0.1",
"version": "1.0.2",
"description": "Parsing string to array of args like node on bash do.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -29,2 +29,4 @@ const test = require('ava');

t.deepEqual(arrgv('aaa b"bb cc"c ddd'), ['aaa', 'bbb ccc', 'ddd'], 'double quotes in words make string arg');
t.deepEqual(arrgv('aaa "" bbb'), ['aaa', '', 'bbb'], 'empty string in double quotes');
t.deepEqual(arrgv('aaa ""'), ['aaa', ''], 'empty string in double quotes on last position');
});

@@ -39,2 +41,4 @@

t.deepEqual(arrgv(`aaa b'bb cc'c ddd`), ['aaa', 'bbb ccc', 'ddd'], 'single quotes in words make string arg');
t.deepEqual(arrgv(`aaa '' bbb`), ['aaa', '', 'bbb'], 'empty string in single quotes');
t.deepEqual(arrgv(`aaa ''`), ['aaa', ''], 'empty string in single quotes on last position');
});

@@ -41,0 +45,0 @@

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