mirror of
				https://github.com/langgenius/dify.git
				synced 2025-10-30 18:33:30 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			19 lines
		
	
	
		
			501 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			19 lines
		
	
	
		
			501 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 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)
 | |
| }
 | 
