🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

shellwords

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

shellwords - npm Package Compare versions

Comparing version

to
0.1.0

12

lib/shellwords.js

@@ -29,3 +29,3 @@ // Generated by CoffeeScript 1.3.3

field = "";
scan(line, /\s*(?:([^\s\\\'\"]+)|'([^\']*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/, function(match) {
scan(line, /\s*(?:([^\s\\\'\"]+)|'((?:[^\'\\]|\\.)*)'|"((?:[^\"\\]|\\.)*)"|(\\.?)|(\S))(\s|$)?/, function(match) {
var dq, escape, garbage, raw, seperator, sq, word;

@@ -48,2 +48,12 @@ raw = match[0], word = match[1], sq = match[2], dq = match[3], escape = match[4], garbage = match[5], seperator = match[6];

exports.escape = function(str) {
if (str == null) {
str = "";
}
if (str == null) {
return "''";
}
return str.replace(/([^A-Za-z0-9_\-.,:\/@\n])/g, "\\$1").replace(/\n/g, "'\n'");
};
}).call(this);

2

package.json

@@ -5,3 +5,3 @@ {

"description": "Manipulate strings according to the word parsing rules of the UNIX Bourne shell.",
"version": "0.0.2",
"version": "0.1.0",
"homepage": "https://github.com/jimmycuadra/shellwords",

@@ -8,0 +8,0 @@ "repository": {

# Shellwords
Shellwords provides a function to manipulate strings according to the word parsing rules of the UNIX Bourne shell.
Shellwords provides functions to manipulate strings according to the word parsing rules of the UNIX Bourne shell. It is based on [the Ruby module of the same name](http://www.ruby-doc.org/stdlib-1.9.3/libdoc/shellwords/rdoc/Shellwords.html).

@@ -12,6 +12,9 @@ ## Installation

``` javascript
var split = require("shellwords").split;
var shellwords = require("shellwords");
console.log(split("foo 'bar baz'"));
shellwords.split("foo 'bar baz'");
// ["foo", "bar baz"]
shellwords.escape("What's up, yo?");
// 'What\\\'s\\ up,\\ yo\\?'
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet