You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

variable.ts 531B

123456789101112131415161718192021
  1. import type {
  2. ValueSelector,
  3. } from '../types'
  4. import type {
  5. BlockEnum,
  6. } from '../types'
  7. import { hasErrorHandleNode } from '.'
  8. export const variableTransformer = (v: ValueSelector | string) => {
  9. if (typeof v === 'string')
  10. return v.replace(/^{{#|#}}$/g, '').split('.')
  11. return `{{#${v.join('.')}#}}`
  12. }
  13. export const isExceptionVariable = (variable: string, nodeType?: BlockEnum) => {
  14. if ((variable === 'error_message' || variable === 'error_type') && hasErrorHandleNode(nodeType))
  15. return true
  16. return false
  17. }