0

I'm reading the article Debugging ES6 in Visual Studio Code and find a syntax in launch.json file that I don't quite understand.

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Launch App.js",
      "program": "${workspaceRoot}/src/app.js",
      "outFiles": [ "${workspaceRoot}/.compiled/**/*.js" ]
    }
}
 "outFiles": [ "${workspaceRoot}/.compiled/**/*.js" ]

What does the ** (two stars) represent? Also, does *.js match filname.js.map beside matching filename.js? I am not sure if this kind of pattern relates to regexr.

3
  • 2
    That looks more like a glob than regex. Either way, it has nothing to do with JSON. Commented Jun 25, 2018 at 6:58
  • 1
    *.js will match filename.js but it should not match filename.js.map It is not a regular expression. Commented Jun 25, 2018 at 7:07
  • Also, this is a duplicate: stackoverflow.com/questions/32604656/what-is-the-glob-character Commented Jun 25, 2018 at 7:11

2 Answers 2

2

This is not a regex (because dot in ".js" does not look like it matches any character).

This is kind of fancy wildcard for a filename:

  1. ${workspaceRoot} - some environmental variable
  2. /.compiled - exact name of folder (e.g. for generated code)
  3. /** - any set of nested folders
  4. /*.js - any file with js extension at path specified before

Also, does *.js match filname.js.map beside matching filename.js?

I assume that it does not, only filename.js.

Sign up to request clarification or add additional context in comments.

Comments

1

the ** (double-glob) means that it will search in any number of subdirectories. For example,

a/**/b

will match

a/a/b

a/c/b

a/c/a/b

and so on.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.