MCPcopy Create free account
hub / github.com/omkarcloud/botasaurus / getSortKey

Method getSortKey

js/botasaurus-server-js/src/sorts.ts:273–286  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

271
272class OldestDateFirstSort extends _DateSort {
273 protected override getSortKey(): (item: any) => [number, number] | [number] {
274 return (item: any) => {
275 const dateStr = item[this.field];
276 if (isNotNullish(dateStr)) {
277 try {
278 const dateObj = this.parseDate(dateStr);
279 return [0, dateObj.getTime()];
280 } catch (error) {
281 // Ignore parsing errors
282 }
283 }
284 return [1];
285 };
286 }
287
288 protected getLabel(): string {
289 const titleCasedField = titleCase(this.field);

Callers

nothing calls this directly

Calls 1

isNotNullishFunction · 0.90

Tested by

no test coverage detected