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

shell-quote

Package Overview
Dependencies
Maintainers
4
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shell-quote - npm Package Compare versions

Comparing version 1.6.1 to 1.6.2

CHANGELOG.md

19

index.js

@@ -1,8 +0,3 @@

var json = typeof JSON !== undefined ? JSON : require('jsonify');
var map = require('array-map');
var filter = require('array-filter');
var reduce = require('array-reduce');
exports.quote = function (xs) {
return map(xs, function (s) {
return xs.map(function (s) {
if (s && typeof s === 'object') {

@@ -39,9 +34,9 @@ return s.op.replace(/(.)/g, '\\$1');

if (typeof env !== 'function') return mapped;
return reduce(mapped, function (acc, s) {
return mapped.reduce(function (acc, s) {
if (typeof s === 'object') return acc.concat(s);
var xs = s.split(RegExp('(' + TOKEN + '.*?' + TOKEN + ')', 'g'));
if (xs.length === 1) return acc.concat(xs[0]);
return acc.concat(map(filter(xs, Boolean), function (x) {
return acc.concat(xs.filter(Boolean).map(function (x) {
if (RegExp('^' + TOKEN).test(x)) {
return json.parse(x.split(TOKEN)[1]);
return JSON.parse(x.split(TOKEN)[1]);
}

@@ -58,3 +53,3 @@ else return x;

].join('|'), 'g');
var match = filter(s.match(chunker), Boolean);
var match = s.match(chunker).filter(Boolean);
var commented = false;

@@ -65,3 +60,3 @@

if (!opts) opts = {};
return map(match, function (s, j) {
return match.map(function (s, j) {
if (commented) {

@@ -198,3 +193,3 @@ return;

if (typeof r === 'object') {
return pre + TOKEN + json.stringify(r) + TOKEN;
return pre + TOKEN + JSON.stringify(r) + TOKEN;
}

@@ -201,0 +196,0 @@ else return pre + r;

{
"name": "shell-quote",
"version": "1.6.1",
"version": "1.6.2",
"description": "quote and parse shell commands",

@@ -45,8 +45,3 @@ "main": "index.js",

"license": "MIT",
"dependencies": {
"jsonify": "~0.0.0",
"array-filter": "~0.0.0",
"array-reduce": "~0.0.0",
"array-map": "~0.0.0"
}
"dependencies": {}
}

@@ -14,12 +14,12 @@ var test = require('tape');

);
t.equal(quote([]), '');
t.equal(quote(["a\nb"]), "'a\nb'");
t.equal(quote([' #(){}*|][!']), "' #(){}*|][!'");
t.equal(quote(["'#(){}*|][!"]), '"\'#(){}*|][\\!"');
t.equal(quote(["X#(){}*|][!"]), "X\\#\\(\\)\\{\\}\\*\\|\\]\\[\\!");
t.equal(quote(["a\n#\nb"]), "'a\n#\nb'");
t.equal(quote(['><;{}']), '\\>\\<\\;\\{\\}');
t.equal(quote([ 'a', 1, true, false ]), 'a 1 true false');
t.equal(quote([ 'a', 1, null, undefined ]), 'a 1 null undefined');
t.end();
t.equal(quote([]), '');
t.equal(quote(["a\nb"]), "'a\nb'");
t.equal(quote([' #(){}*|][!']), "' #(){}*|][!'");
t.equal(quote(["'#(){}*|][!"]), '"\'#(){}*|][\\!"');
t.equal(quote(["X#(){}*|][!"]), "X\\#\\(\\)\\{\\}\\*\\|\\]\\[\\!");
t.equal(quote(["a\n#\nb"]), "'a\n#\nb'");
t.equal(quote(['><;{}']), '\\>\\<\\;\\{\\}');
t.equal(quote([ 'a', 1, true, false ]), 'a 1 true false');
t.equal(quote([ 'a', 1, null, undefined ]), 'a 1 null undefined');
t.end();
});

@@ -26,0 +26,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