Skip to content

Commit 87c03a0

Browse files
authored
Fix typo in dangerfile.js which results in an unreachable code path… (facebook#32277)
## Summary Fix typo in dangerfile.js which results in an unreachable code path which ought to be hit when there is no matching base artifact during DangerCI automated code review. See: https://github.com/facebook/react/blob/221f3002caa2314cba0a62950da6fb92b453d1d0/dangerfile.js#L73 Compare: https://github.com/facebook/react/blob/221f3002caa2314cba0a62950da6fb92b453d1d0/dangerfile.js#L171 And the case which should hit this code path: https://github.com/facebook/react/blob/221f3002caa2314cba0a62950da6fb92b453d1d0/dangerfile.js#L160 Given the above context, the condition `Number === Infinity` is clearly meant to be `decimal === Infinity`, which it will be if the `catch` statement triggers when there is no matching base artifact. Without this fix, the primitive value `Infinity` is passed to `percentFormatter.format(decimal)`, resulting in the string `'+∞%'`. With this fix, the resulting string will be the intended `'New file'`. ## [Resolves issue 32278](facebook#32278)
1 parent 221f300 commit 87c03a0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dangerfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const percentFormatter = new Intl.NumberFormat('en', {
7070
});
7171

7272
function change(decimal) {
73-
if (Number === Infinity) {
73+
if (decimal === Infinity) {
7474
return 'New file';
7575
}
7676
if (decimal === -1) {

0 commit comments

Comments
 (0)