@ptolemy2002/rgx 11.1.0 → 11.1.1

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.
@@ -2,15 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rgxTaggedTemplateToArray = rgxTaggedTemplateToArray;
4
4
  function rgxTaggedTemplateToArray(strings, tokens, multiline, verbatim) {
5
- function isNullOrUndefined(value) {
6
- return value === null || value === undefined;
7
- }
8
5
  const array = [];
9
6
  for (let i = 0; i < Math.max(strings.length, tokens.length); i++) {
7
+ const isTokensEnd = i >= tokens.length;
10
8
  const string = strings[i];
11
9
  const token = tokens[i];
12
10
  // Strings always come before tokens
13
- if (!isNullOrUndefined(string)) {
11
+ if (string !== undefined) {
14
12
  if (!multiline) {
15
13
  if (verbatim)
16
14
  array.push(string);
@@ -33,10 +31,10 @@ function rgxTaggedTemplateToArray(strings, tokens, multiline, verbatim) {
33
31
  resolves to "foo | bar |baz" instead of "foo | bar|baz"
34
32
  */
35
33
  .map((line, i) => (i !== 0 || startsNewLine) ? line.trimStart() : line)
36
- // Remove comments both for the start of the line.
34
+ // Remove comments from the start of the line.
37
35
  .filter(line => !line.startsWith("//"))
38
36
  .filter(line => line.length > 0)
39
- // Remove comments at the end of the line.
37
+ // Remove comments from the end of the line.
40
38
  .map(line => {
41
39
  const commentIndex = line.indexOf("//");
42
40
  if (commentIndex !== -1) {
@@ -51,7 +49,7 @@ function rgxTaggedTemplateToArray(strings, tokens, multiline, verbatim) {
51
49
  array.push({ rgxInterpolate: true, toRgx: () => lines });
52
50
  }
53
51
  }
54
- if (!isNullOrUndefined(token))
52
+ if (!isTokensEnd)
55
53
  array.push(token);
56
54
  }
57
55
  return array;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/rgx",
3
- "version": "11.1.0",
3
+ "version": "11.1.1",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",