执行过npm install命令的vue-element-admin源码
康凯
2022-05-20 aa4c235a8ca67ea8b731f90c951a465e92c0a865
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"use strict";
 
module.exports = parseArgsStringToArgv;
module.exports.parseArgsStringToArgv = parseArgsStringToArgv;
 
function parseArgsStringToArgv(value, env, file) {
  // ([^\s'"]+(['"])([^\2]*?)\2) Match `text"quotes text"`
 
  // [^\s'"] or Match if not a space ' or "
 
  // (['"])([^\4]*?)\4 or Match "quoted text" without quotes
  // `\2` and `\4` are a backreference to the quote style (' or ") captured
  var myRegexp = /([^\s'"]+(['"])([^\2]*?)\2)|[^\s'"]+|(['"])([^\4]*?)\4/gi;
  var myString = value;
  var myArray = [
  ];
  if (env) {
    myArray.push(env);
  }
  if (file) {
    myArray.push(file);
  }
  var match;
  do {
        // Each call to exec returns the next regex match as an array
    match = myRegexp.exec(myString);
    if (match !== null) {
      // Index 1 in the array is the captured group if it exists
      // Index 0 is the matched text, which we use if no captured group exists
      myArray.push(match[1] || match[5] || match[0]);
    }
  } while (match !== null);
 
  return myArray;
}