MCPcopy Create free account
hub / github.com/TanStack/db / compareCreatedAt

Method compareCreatedAt

packages/db/src/transactions.ts:547–554  ·  view source on GitHub ↗

* Compare two transactions by their createdAt time and sequence number in order * to sort them in the order they were created. * @param other - The other transaction to compare to * @returns -1 if this transaction was created before the other, 1 if it was created after, 0 if they were creat

(other: Transaction<any>)

Source from the content-addressed store, hash-verified

545 * @returns -1 if this transaction was created before the other, 1 if it was created after, 0 if they were created at the same time
546 */
547 compareCreatedAt(other: Transaction<any>): number {
548 const createdAtComparison =
549 this.createdAt.getTime() - other.createdAt.getTime()
550 if (createdAtComparison !== 0) {
551 return createdAtComparison
552 }
553 return this.sequenceNumber - other.sequenceNumber
554 }
555}
556
557export type { Transaction }

Callers 1

constructorMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected