@artilleryio/int-commons 2.0.1-c34ae8a → 2.0.1-c6362a6
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 +8 -0
- 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
|
}
|