UNPKG
@zoroaster/fork
Version:
latest (1.5.0)
1.5.0
1.4.0
1.3.3
1.3.2
1.3.1
1.3.0
1.2.3
1.2.2
1.2.1
1.2.0
1.1.1
1.1.0
1.0.0
Test forks.
www.contexttesting.com
contexttesting/fork
@zoroaster/fork
/
src
/
lib
/
get-args.js
13 lines
(11 loc)
•
287 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
import
mismatch
from
'mismatch'
/** * Return shell arguments from a string. *
@param
{
string
}
input
*/
const
getArgs
= (
input
) => {
const
res =
mismatch
(
/(['"])?([\s\S]+?)\1(\s+|$)/g
, input, [
'q'
,
'a'
]) .
map
(
(
{
'a'
: a }
) =>
a)
return
res }
export
default
getArgs