Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ParthBarot-BoTreeConsulting/4811c4b9dba2acaf035d2bda1a6cbf24 to your computer and use it in GitHub Desktop.
Save ParthBarot-BoTreeConsulting/4811c4b9dba2acaf035d2bda1a6cbf24 to your computer and use it in GitHub Desktop.
JS refactoring - Pseudo code
DEFINE amount, fixedVal, myDataVal
IF RANGE(0 - 12) INCLUDES myDataVal
IF RANGE(0,12000) INCLUDES amount
IF RANGE(0,95) INCLUDES calculatedVal
RETURN 0.8
ELSEIF RANGE(95,*) INCLUDES calculatedVal
RETURN 0.7
ENDIF
ELSE
IF RANGE(0,95) INCLUDES calculatedVal
RETURN 1.0
ELSEIF RANGE(95,*) INCLUDES calculatedVal
RETURN 1.1
ENDIF
ENDIF
ELSEIF RANGE(12,*) INCLUDES myDataVal
IF RANGE(0,12000) INCLUDES amount
IF RANGE(0,90) INCLUDES calculatedVal
RETURN 0.4
ELSEIF RANGE(90,*) INCLUDES calculatedVal
RETURN 0.7
ENDIF
ELSE
IF RANGE(0,78) INCLUDES calculatedVal
RETURN 0.4
ELSEIF RANGE(78,90) INCLUDES calculatedVal
RETURN 0.7
ELSEIF RANGE(90,*) INCLUDES calculatedVal
RETURN 0.9
ENDIF
ENDIF
ENDIF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment