@artilleryio/int-commons 2.0.1-ecd59d7 → 2.0.1-ed94c28

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.
Files changed (2) hide show
  1. package/engine_util.js +8 -0
  2. package/package.json +2 -1
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,
@@ -607,10 +609,16 @@ function extractRegExp(doc, expr, opts) {
607
609
  return '';
608
610
  }
609
611
 
612
+ // Captures named group (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Named_capturing_group)
610
613
  if (group && match.groups) {
611
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]) {
617
+ return match[group];
618
+ // Defaults to first match if found and no group defined
612
619
  } else if (match[0]) {
613
620
  return match[0];
621
+ // If no match returns empty string
614
622
  } else {
615
623
  return '';
616
624
  }
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@artilleryio/int-commons",
3
- "version": "2.0.1-ecd59d7",
3
+ "version": "2.0.1-ed94c28",
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",