wwf
2025-05-20 938c3e5a587ce950a94964ea509b9e7f8834dfae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import type {
  ValueSelector,
} from '../types'
import type {
  BlockEnum,
} 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)
}