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.

Biffen
  • 6,249
  • 6
  • 28
  • 36
Wayne Li
  • 411
  • 1
  • 6
  • 16
  • 2
    That looks more like a [glob](https://en.wikipedia.org/wiki/Glob_(programming)) than regex. Either way, it has nothing to do with JSON. – Biffen Jun 25 '18 at 06:58
  • 1
    `*.js` will match `filename.js` but it should not match `filename.js.map` It is not a regular expression. – mankowitz Jun 25 '18 at 07:07
  • Also, this is a duplicate: https://stackoverflow.com/questions/32604656/what-is-the-glob-character – mankowitz Jun 25 '18 at 07:11

2 Answers2

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.

Serg
  • 1,347
  • 1
  • 8
  • 15
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.

mankowitz
  • 1,864
  • 1
  • 14
  • 32