@artilleryio/int-commons 2.0.0 → 2.0.1-0467c8d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/engine_util.js CHANGED
@@ -22,6 +22,8 @@ try {
22
22
  xmlCapture = null;
23
23
  }
24
24
 
25
+ // TODO Write tests
26
+
25
27
  module.exports = {
26
28
  createThink: createThink,
27
29
  createLoopWithCount: createLoopWithCount,
@@ -606,10 +608,17 @@ function extractRegExp(doc, expr, opts) {
606
608
  if (!match) {
607
609
  return '';
608
610
  }
609
- if (group && match[group]) {
611
+
612
+ // Captures named group (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Named_capturing_group)
613
+ if (group && match.groups) {
614
+ return match.groups[group];
615
+ // Captures integer index defined group since those don't show up in match.groups
616
+ } else if (group && match[group]) {
610
617
  return match[group];
618
+ // Defaults to first match if found and no group defined
611
619
  } else if (match[0]) {
612
620
  return match[0];
621
+ // If no match returns empty string
613
622
  } else {
614
623
  return '';
615
624
  }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  module.exports = {
2
2
  engine_util: require('./engine_util'),
3
3
  jitter: require('./jitter')
4
- }
4
+ };
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@artilleryio/int-commons",
3
- "version": "2.0.0",
3
+ "version": "2.0.1-0467c8d",
4
4
  "main": "./index.js",
5
+ "license": "MPL-2.0",
5
6
  "dependencies": {
6
7
  "async": "^2.6.4",
7
8
  "cheerio": "^1.0.0-rc.10",
@@ -10,5 +11,9 @@
10
11
  "espree": "^9.4.1",
11
12
  "jsonpath-plus": "^7.2.0",
12
13
  "lodash": "^4.17.19"
14
+ },
15
+ "scripts": {
16
+ "lint": "eslint --ext \".js,.ts,.tsx\" .",
17
+ "lint-fix": "npm run lint -- --fix"
13
18
  }
14
- }
19
+ }