Skip to content

Commit

Permalink
fix: digit contracts zero behavior (deriv-com#14190)
Browse files Browse the repository at this point in the history
  • Loading branch information
akmal-deriv authored Mar 21, 2024
1 parent 0ddf877 commit 419d100
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ const LastDigitPrediction = ({
[key: string]: (val: number | null) => boolean;
} = {
DIGITMATCH: (val: number | null) => val === barrier,
DIGITDIFF: (val: number | null) => val !== barrier && !!barrier && !isNaN(barrier),
DIGITOVER: (val: number | null) => !!(val && barrier) && val > barrier,
DIGITUNDER: (val: number | null) => !!(val && barrier) && val < barrier,
DIGITDIFF: (val: number | null) => val !== barrier,
DIGITOVER: (val: number | null) => !!((val || val === 0) && (barrier || barrier === 0)) && val > barrier,
DIGITUNDER: (val: number | null) => !!((val || val === 0) && (barrier || barrier === 0)) && val < barrier,
DIGITODD: (val: number | null) => !!val && Boolean(val % 2),
DIGITEVEN: (val: number | null) => !!val && !(val % 2),
DIGITEVEN: (val: number | null) => (!!val && !(val % 2)) || val === 0,
};
if (!contract_type || !barrier_map[contract_type]) return null;
return barrier_map[contract_type](num) ? num : null;
Expand Down

0 comments on commit 419d100

Please sign in to comment.