mirror of
https://github.com/google/blockly.git
synced 2026-01-04 15:40:08 +01:00
Change parseFloat() to Number()
Number() is a bit less forgiving than parseFloat() and is more likely to generate NaN rather than some random number. An audit of each case shows nowhere that parseFloat()’s features are needed.
This commit is contained in:
@@ -354,7 +354,7 @@ Blockly.JavaScript['lists_sort'] = function(block) {
|
||||
'(type, direction) {',
|
||||
' var compareFuncs = {',
|
||||
' "NUMERIC": function(a, b) {',
|
||||
' return parseFloat(a) - parseFloat(b); },',
|
||||
' return Number(a) - Number(b); },',
|
||||
' "TEXT": function(a, b) {',
|
||||
' return a.toString() > b.toString() ? 1 : -1; },',
|
||||
' "IGNORE_CASE": function(a, b) {',
|
||||
|
||||
Reference in New Issue
Block a user