File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
packages/node_modules/pouchdb-core/src Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -40,10 +40,6 @@ import {
4040 * A generic pouch adapter
4141 */
4242
43- function compare ( left , right ) {
44- return left < right ? - 1 : left > right ? 1 : 0 ;
45- }
46-
4743// Wrapper for functions that call the bulkdocs api with a single doc,
4844// if the first result is an error, return an error
4945function yankError ( callback , docId ) {
@@ -78,13 +74,12 @@ function cleanDocs(docs) {
7874
7975// compare two docs, first by _id then by _rev
8076function compareByIdThenRev ( a , b ) {
81- var idCompare = compare ( a . _id , b . _id ) ;
82- if ( idCompare !== 0 ) {
83- return idCompare ;
77+ if ( a . _id === b . _id ) {
78+ const aStart = a . _revisions ? a . _revisions . start : 0 ;
79+ const bStart = b . _revisions ? b . _revisions . start : 0 ;
80+ return aStart - bStart ;
8481 }
85- var aStart = a . _revisions ? a . _revisions . start : 0 ;
86- var bStart = b . _revisions ? b . _revisions . start : 0 ;
87- return compare ( aStart , bStart ) ;
82+ return a . _id < b . _id ? - 1 : 1 ;
8883}
8984
9085// for every node in a revision tree computes its distance from the closest
You can’t perform that action at this time.
0 commit comments