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

splitargs

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

splitargs - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

46

package.json
{
"name": "splitargs",
"version": "0.0.5",
"description": "Splits strings into tokens by given separator except treating quoted part as a single token.",
"main": "splitargs.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/elgs/splitargs"
},
"keywords": [
"split",
"args",
"quoted",
"space"
],
"author": "Elgs Chen",
"license": "ISC",
"bugs": {
"url": "https://github.com/elgs/splitargs/issues"
},
"homepage": "https://github.com/elgs/splitargs"
"name": "splitargs",
"version": "0.0.6",
"description": "Splits strings into tokens by given separator except treating quoted part as a single token.",
"main": "splitargs.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/elgs/splitargs"
},
"keywords": [
"split",
"args",
"quoted",
"space"
],
"author": "Elgs Chen",
"license": "ISC",
"bugs": {
"url": "https://github.com/elgs/splitargs/issues"
},
"homepage": "https://github.com/elgs/splitargs"
}

@@ -8,4 +8,4 @@ /**

module.exports = function (input, separator, keepQuotes) {
separator = separator || /\s/g;
module.exports = function (input, sep, keepQuotes) {
var separator = sep || /\s/g;
var singleQuoteOpen = false;

@@ -35,8 +35,9 @@ var doubleQuoteOpen = false;

if (!singleQuoteOpen && !doubleQuoteOpen && matches) {
if (tokenBuffer && tokenBuffer.length > 0) {
if (tokenBuffer.length > 0) {
ret.push(tokenBuffer.join(''));
tokenBuffer = [];
} else {
} else if (!!sep) {
ret.push('');
}
} else {

@@ -43,0 +44,0 @@ tokenBuffer.push(element);

@@ -17,3 +17,3 @@ /**

it('should split double quoted string', function () {
var i = "I said 'I am sorry.', and he said \"it doesn't matter.\"";
var i = "I said 'I am sorry.', and he said \"it doesn't matter.\"";
var o = splitargs(i);

@@ -20,0 +20,0 @@ expect(o.length).toBe(7);

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