n8n/packages/editor-ui/src/utils/expressions.ts

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
353 B
TypeScript
Raw Normal View History

import { ExpressionParser } from 'n8n-workflow';
export const isExpression = (expr: string) => expr.startsWith('=');
export const isTestableExpression = (expr: string) => {
return ExpressionParser.splitExpression(expr).every((c) => {
if (c.type === 'text') {
return true;
}
return /\$secrets(\.[a-zA-Z0-9_]+)+$/.test(c.text.trim());
});
};