Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@n8n/tournament

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@n8n/tournament - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

8

dist/index.d.ts
import type { ExpressionAnalysis } from './ExpressionBuilder';
import type { ExpressionEvaluatorClass } from './Evaluator';
export type { TmplDifference } from './Analysis';
export type { ExpressionEvaluator, ExpressionEvaluatorClass } from './Evaluator';
export type ReturnValue = string | null | (() => unknown);

@@ -9,8 +7,8 @@ export declare class Tournament {

private _dataNodeName;
private evaluator;
constructor(errorHandler?: (error: Error) => void, _dataNodeName?: string, Evaluator?: ExpressionEvaluatorClass);
setEvaluator(Evaluator: ExpressionEvaluatorClass): void;
private _codeCache;
constructor(errorHandler?: (error: Error) => void, _dataNodeName?: string);
getExpressionCode(expr: string): [string, ExpressionAnalysis];
tmplDiff(expr: string): import("./Analysis").TmplDifference;
private getFunction;
execute(expr: string, data: unknown): ReturnValue;
}

@@ -6,13 +6,9 @@ "use strict";

const Analysis_1 = require("./Analysis");
const FunctionEvaluator_1 = require("./FunctionEvaluator");
const DATA_NODE_NAME = '___n8n_data';
class Tournament {
constructor(errorHandler = () => { }, _dataNodeName = DATA_NODE_NAME, Evaluator = FunctionEvaluator_1.FunctionEvaluator) {
constructor(errorHandler = () => { }, _dataNodeName = DATA_NODE_NAME) {
this.errorHandler = errorHandler;
this._dataNodeName = _dataNodeName;
this.setEvaluator(Evaluator);
this._codeCache = {};
}
setEvaluator(Evaluator) {
this.evaluator = new Evaluator(this);
}
getExpressionCode(expr) {

@@ -24,2 +20,11 @@ return (0, ExpressionBuilder_1.getExpressionCode)(expr, this._dataNodeName);

}
getFunction(expr) {
if (expr in this._codeCache) {
return this._codeCache[expr];
}
const [code, analysis] = this.getExpressionCode(expr);
const func = new Function('E', code + ';');
this._codeCache[expr] = [func, analysis];
return [func, analysis];
}
execute(expr, data) {

@@ -29,3 +34,4 @@ if (!expr) {

}
return this.evaluator.evaluate(expr, data);
const fn = this.getFunction(expr)[0];
return fn.call(data, this.errorHandler);
}

@@ -32,0 +38,0 @@ }

@@ -24,3 +24,2 @@ "use strict";

};
const polyfillExceptions = ['this', 'window', 'global'];
const polyfillVar = (path, dataNode, force = false) => {

@@ -32,5 +31,2 @@ if (!force) {

}
if (polyfillExceptions.includes(path.node.name)) {
return;
}
path.replace(buildGlobalSwitch(path.node, dataNode));

@@ -37,0 +33,0 @@ };

{
"name": "@n8n/tournament",
"version": "1.0.1",
"version": "1.0.2",
"description": "Output compatible rewrite of riot tmpl",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -23,2 +23,4 @@ import type { namedTypes } from 'ast-types';

const shouldAlwaysWrapList = ['window', 'global', 'this'];
const shouldWrapInTry = (node: namedTypes.ASTNode) => {

@@ -36,2 +38,10 @@ let shouldWrap = false;

},
visitIdentifier(path) {
if (shouldAlwaysWrapList.includes(path.node.name)) {
shouldWrap = true;
return false;
}
this.traverse(path);
return;
},
});

@@ -38,0 +48,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc