Gathering detailed insights and metrics for shell-quote
Gathering detailed insights and metrics for shell-quote
Gathering detailed insights and metrics for shell-quote
Gathering detailed insights and metrics for shell-quote
npm install shell-quote
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
28 Stars
204 Commits
10 Forks
4 Watching
2 Branches
17 Contributors
Updated on 27 Nov 2024
Minified
Minified + Gzipped
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-7.6%
4,113,202
Compared to previous day
Last week
2.5%
24,030,487
Compared to previous week
Last month
11.1%
98,880,756
Compared to previous month
Last year
23.9%
983,406,155
Compared to previous year
Parse and quote shell commands.
1var quote = require('shell-quote/quote'); 2var s = quote([ 'a', 'b c d', '$f', '"g"' ]); 3console.log(s);
output
a 'b c d' \$f '"g"'
1var parse = require('shell-quote/parse'); 2var xs = parse('a "b c" \\$def \'it\\\'s great\''); 3console.dir(xs);
output
[ 'a', 'b c', '\\$def', 'it\'s great' ]
1var parse = require('shell-quote/parse'); 2var xs = parse('beep --boop="$PWD"', { PWD: '/home/robot' }); 3console.dir(xs);
output
[ 'beep', '--boop=/home/robot' ]
1var parse = require('shell-quote/parse'); 2var xs = parse('beep ^--boop="$PWD"', { PWD: '/home/robot' }, { escape: '^' }); 3console.dir(xs);
output
[ 'beep --boop=/home/robot' ]
1var parse = require('shell-quote/parse'); 2var xs = parse('beep || boop > /byte'); 3console.dir(xs);
output:
[ 'beep', { op: '||' }, 'boop', { op: '>' }, '/byte' ]
1var parse = require('shell-quote/parse'); 2var xs = parse('beep > boop # > kaboom'); 3console.dir(xs);
output:
[ 'beep', { op: '>' }, 'boop', { comment: '> kaboom' } ]
1var quote = require('shell-quote/quote'); 2var parse = require('shell-quote/parse');
Return a quoted string for the array args
suitable for using in shell
commands.
Return an array of arguments from the quoted string cmd
.
Interpolate embedded bash-style $VARNAME
and ${VARNAME}
variables with
the env
object which like bash will replace undefined variables with ""
.
env
is usually an object but it can also be a function to perform lookups.
When env(key)
returns a string, its result will be output just like env[key]
would. When env(key)
returns an object, it will be inserted into the result
array like the operator objects.
When a bash operator is encountered, the element in the array with be an object
with an "op"
key set to the operator string. For example:
'beep || boop > /byte'
parses as:
[ 'beep', { op: '||' }, 'boop', { op: '>' }, '/byte' ]
With npm do:
npm install shell-quote
MIT
The latest stable version of the package.
Stable Version
2
9.8/10
Summary
Improper Neutralization of Special Elements used in a Command in Shell-quote
Affected Versions
<= 1.7.2
Patched Versions
1.7.3
9.8/10
Summary
Potential Command Injection in shell-quote
Affected Versions
< 1.6.1
Patched Versions
1.6.1
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 3/30 approved changesets -- score normalized to 1
Reason
0 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More