@n8n/tournament
Advanced tools
Comparing version 1.0.5 to 1.0.6
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.joinExpression = exports.splitExpression = exports.escapeCode = void 0; | ||
const OPEN_BRACKET = /(?<escape>\\|)(?<brackets>\{\{)/; | ||
const CLOSE_BRACKET = /(?<escape>\\|)(?<brackets>\}\})/; | ||
const OPEN_BRACKET = /(?<brackets>\{\{)/; | ||
const CLOSE_BRACKET = /(?<brackets>\}\})/; | ||
const escapeCode = (text) => { | ||
@@ -10,3 +10,7 @@ return text.replace('\\}}', '}}'); | ||
exports.escapeCode = escapeCode; | ||
const normalizeBackslashes = (text) => { | ||
return text.replace(/\\\\/g, '\\'); | ||
}; | ||
const splitExpression = (expression) => { | ||
var _a, _b, _c; | ||
const chunks = []; | ||
@@ -37,5 +41,8 @@ let searchingFor = 'open'; | ||
} | ||
if (res.groups.escape) { | ||
buffer += expr.slice(0, res.index + 3); | ||
index += res.index + 3; | ||
const beforeMatch = expr.slice(0, res.index); | ||
const backslashCount = (_c = (_b = (_a = beforeMatch.match(/\\*$/)) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : 0; | ||
const isEscaped = backslashCount % 2 === 1; | ||
if (isEscaped) { | ||
buffer += expr.slice(0, res.index + '{{'.length); | ||
index += res.index + '{{'.length; | ||
} | ||
@@ -47,3 +54,3 @@ else { | ||
type: 'text', | ||
text: buffer, | ||
text: normalizeBackslashes(buffer), | ||
}); | ||
@@ -50,0 +57,0 @@ searchingFor = 'close'; |
{ | ||
"name": "@n8n/tournament", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Output compatible rewrite of riot tmpl", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -16,4 +16,4 @@ export interface ExpressionText { | ||
const OPEN_BRACKET = /(?<escape>\\|)(?<brackets>\{\{)/; | ||
const CLOSE_BRACKET = /(?<escape>\\|)(?<brackets>\}\})/; | ||
const OPEN_BRACKET = /(?<brackets>\{\{)/; | ||
const CLOSE_BRACKET = /(?<brackets>\}\})/; | ||
@@ -24,2 +24,6 @@ export const escapeCode = (text: string): string => { | ||
const normalizeBackslashes = (text: string): string => { | ||
return text.replace(/\\\\/g, '\\'); | ||
}; | ||
export const splitExpression = (expression: string): ExpressionChunk[] => { | ||
@@ -56,5 +60,10 @@ const chunks: ExpressionChunk[] = []; | ||
} | ||
if (res.groups.escape) { | ||
buffer += expr.slice(0, res.index + 3); | ||
index += res.index + 3; | ||
const beforeMatch = expr.slice(0, res.index); | ||
const backslashCount = beforeMatch.match(/\\*$/)?.[0]?.length ?? 0; | ||
const isEscaped = backslashCount % 2 === 1; | ||
if (isEscaped) { | ||
buffer += expr.slice(0, res.index + '{{'.length); | ||
index += res.index + '{{'.length; | ||
} else { | ||
@@ -66,3 +75,3 @@ buffer += expr.slice(0, res.index); | ||
type: 'text', | ||
text: buffer, | ||
text: normalizeBackslashes(buffer), | ||
}); | ||
@@ -69,0 +78,0 @@ searchingFor = 'close'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138263
1970