@carto/api-client 0.5.9 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1339,7 +1339,7 @@ type FormulaResponse = {
1339
1339
  };
1340
1340
  /** Entry in the category widget response, see {@link WidgetRemoteSource#getCategories}. */
1341
1341
  type CategoryResponseEntry = {
1342
- name: string | null;
1342
+ name: string | number | null;
1343
1343
  value: number;
1344
1344
  };
1345
1345
  /** Response from {@link WidgetRemoteSource#getCategories}. */
@@ -1339,7 +1339,7 @@ type FormulaResponse = {
1339
1339
  };
1340
1340
  /** Entry in the category widget response, see {@link WidgetRemoteSource#getCategories}. */
1341
1341
  type CategoryResponseEntry = {
1342
- name: string | null;
1342
+ name: string | number | null;
1343
1343
  value: number;
1344
1344
  };
1345
1345
  /** Response from {@link WidgetRemoteSource#getCategories}. */
@@ -6793,17 +6793,20 @@ function groupValuesByColumn({
6793
6793
  function getSorter(orderBy) {
6794
6794
  switch (orderBy) {
6795
6795
  case "frequency_asc":
6796
- return (a, b) => a.value - b.value || localeCompare(a.name, b.name);
6796
+ return (a, b) => a.value - b.value || nameCompare(a.name, b.name);
6797
6797
  case "frequency_desc":
6798
- return (a, b) => b.value - a.value || localeCompare(a.name, b.name);
6798
+ return (a, b) => b.value - a.value || nameCompare(a.name, b.name);
6799
6799
  case "alphabetical_asc":
6800
- return (a, b) => localeCompare(a.name, b.name) || b.value - a.value;
6800
+ return (a, b) => nameCompare(a.name, b.name) || b.value - a.value;
6801
6801
  case "alphabetical_desc":
6802
- return (a, b) => localeCompare(b.name, a.name) || b.value - a.value;
6802
+ return (a, b) => nameCompare(b.name, a.name) || b.value - a.value;
6803
6803
  }
6804
6804
  }
6805
- function localeCompare(a, b) {
6806
- return (a ?? "null").localeCompare(b ?? "null");
6805
+ function nameCompare(a, b) {
6806
+ if (typeof a === "number" && typeof b === "number") {
6807
+ return a - b;
6808
+ }
6809
+ return String(a ?? "null").localeCompare(String(b ?? "null"));
6807
6810
  }
6808
6811
 
6809
6812
  // src/utils/dateUtils.ts