We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 74e957f commit 5055bbcCopy full SHA for 5055bbc
std/portable/index.js
@@ -206,6 +206,24 @@ if (!String.prototype.replaceAll) {
206
});
207
}
208
209
+function defaultComparator(a, b) {
210
+ if (a === b) {
211
+ if (a !== 0) return 0;
212
+ a = 1 / a, b = 1 / b;
213
+ } else {
214
+ var nanA = a != a, nanB = b != b;
215
+ if (nanA | nanB) return nanA - nanB;
216
+ if (a == null) a = String(a);
217
+ if (b == null) b = String(b);
218
+ }
219
+ return a > b ? 1 : -1;
220
+}
221
+
222
+const arraySort = Array.prototype.sort;
223
+Array.prototype.sort = function sort(comparator) {
224
+ return arraySort.call(this, comparator || defaultComparator);
225
+};
226
227
globalScope["isInteger"] = Number.isInteger;
228
229
globalScope["isFloat"] = function isFloat(arg) {
0 commit comments