@guardian/interactive-component-library 0.1.0-alpha.36 → 0.1.0-alpha.37
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.
|
@@ -1204,6 +1204,11 @@ const sortAscending = (accessor) => {
|
|
|
1204
1204
|
return (a, b) => {
|
|
1205
1205
|
const valueA = a[accessor];
|
|
1206
1206
|
const valueB = b[accessor];
|
|
1207
|
+
if (valueA === null) {
|
|
1208
|
+
return -1;
|
|
1209
|
+
} else if (valueB === null) {
|
|
1210
|
+
return 1;
|
|
1211
|
+
}
|
|
1207
1212
|
if (valueA < valueB)
|
|
1208
1213
|
return -1;
|
|
1209
1214
|
if (valueA > valueB)
|
|
@@ -1215,6 +1220,11 @@ const sortDescending = (accessor) => {
|
|
|
1215
1220
|
return (a, b) => {
|
|
1216
1221
|
const valueA = a[accessor];
|
|
1217
1222
|
const valueB = b[accessor];
|
|
1223
|
+
if (valueA === null) {
|
|
1224
|
+
return 1;
|
|
1225
|
+
} else if (valueB === null) {
|
|
1226
|
+
return -1;
|
|
1227
|
+
}
|
|
1218
1228
|
if (valueA > valueB)
|
|
1219
1229
|
return -1;
|
|
1220
1230
|
if (valueA < valueB)
|
|
@@ -1317,7 +1327,7 @@ class CellModel {
|
|
|
1317
1327
|
const rowData = JSON.stringify(this.row, null, 2);
|
|
1318
1328
|
throw new Error(`Missing value for key ${this.column.accessor} in ${rowData}`);
|
|
1319
1329
|
}
|
|
1320
|
-
return this.row[this.column.accessor].toString();
|
|
1330
|
+
return this.row[this.column.accessor] !== null ? this.row[this.column.accessor].toString() : "null";
|
|
1321
1331
|
}
|
|
1322
1332
|
}
|
|
1323
1333
|
const table = "_table_1dg64_9";
|