dify/web/app/components/workflow/utils/variable.ts
Stephen Zhou f2842da397
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
2025-12-23 16:58:55 +08:00

17 lines
473 B
TypeScript

import type {
BlockEnum,
ValueSelector,
} from '../types'
import { hasErrorHandleNode } from '.'
export const variableTransformer = (v: ValueSelector | string) => {
if (typeof v === 'string')
return v.replace(/^\{\{#|#\}\}$/g, '').split('.')
return `{{#${v.join('.')}#}}`
}
export const isExceptionVariable = (variable: string, nodeType?: BlockEnum) => {
return (variable === 'error_message' || variable === 'error_type') && hasErrorHandleNode(nodeType)
}