patch pour le bogue de toLowercase() appliqué sur un integer : on améliore la détection des nombre en acceptant les string qui sont des nombre + on passe toString() avant toLowercase pour ne pas planter quoi qu'on envoie comme type de valeur

This commit is contained in:
cy_altern 2022-05-14 16:54:55 +02:00
parent b6f83ea2ad
commit da912987cf
2 changed files with 9 additions and 9 deletions

View file

@ -709,11 +709,11 @@ let monTableau = {
this.quelleVue = vue; this.quelleVue = vue;
}, },
ordonnerSelect(a, b) { ordonnerSelect(a, b) {
if (Number.isInteger(a) && Number.isInteger(b)) { if ((Number.isInteger(a) || parseInt(a) == a) && (Number.isInteger(b) || parseInt(b) == b)) {
return a - b; return parseInt(a) - parseInt(b);
} else { } else {
let x = a.toLowerCase(); let x = toString(a).toLowerCase();
let y = b.toLowerCase(); let y = toString(b).toLowerCase();
if (x < y) { if (x < y) {
return -1; return -1;
} }

View file

@ -20,7 +20,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
jQuery(function () { jQuery(function () {
$('#app').on('click', '.url_action', function (e) { $('#app').on('click', '.url_action', function (e) {
@ -822,11 +822,11 @@ var monTableau = {
this.quelleVue = vue; this.quelleVue = vue;
}, },
ordonnerSelect: function ordonnerSelect(a, b) { ordonnerSelect: function ordonnerSelect(a, b) {
if (Number.isInteger(a) && Number.isInteger(b)) { if ((Number.isInteger(a) || parseInt(a) == a) && (Number.isInteger(b) || parseInt(b) == b)) {
return a - b; return parseInt(a) - parseInt(b);
} else { } else {
var x = a.toLowerCase(); var x = toString(a).toLowerCase();
var y = b.toLowerCase(); var y = toString(b).toLowerCase();
if (x < y) { if (x < y) {
return -1; return -1;