Commit d4b48a04 authored by Abinesh Lal's avatar Abinesh Lal
Browse files

DEV: Reverted the coding style with state transition


Signed-off-by: Abinesh Lal's avatarAbinesh <abinesh.lal@gramenerit.com>
parent 81fa2d8d
Pipeline #41770 passed with stage
in 1 minute and 7 seconds
var state_transitions = {
'date': {
'null': {state: 'date'},
'date': {state: 'date'},
'default': {state: 'mixed', end: true}
},
'number': {
'null': {state: 'number'},
'number': {state: 'number'},
'default': {state: 'mixed', end: true}
},
'boolean': {
'null': {state: 'boolean'},
'boolean': {state: 'boolean'},
'default': {state: 'mixed', end: true}
},
'string': {
'null': {state: 'string'},
'string': {state: 'string'},
'default': {state: 'mixed', end: true}
},
'object': {
'null': {state: 'object'},
'object': {state: 'object'},
'default': {state: 'mixed', end: true}
}
}
export function types(data, options) {
options = options || {}
options.convert = options.convert || false
......@@ -48,15 +77,11 @@ export function types(data, options) {
type = 'boolean'
}
var state_transitions = {
'null': {state: type},
'true': {state: type},
'false': {state: 'mixed', end: true}
}
var state_transition = state_transitions[(result_type != 'null') ? (result_type == type).toString() : result_type];
result_type = state_transition['state']
if (state_transition['end'])
var state_transition = state_transitions[type] || {}
var change = state_transition[result_type] || state_transition['default']
result_type = change['state']
if (change['end'])
break
}
result[column] = result_type
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment