lib/document.js
function compoundCompareThings (fields) {
  return function (a, b) {
    var i, len, comparison;

    // undefined
    if (a === undefined) { return b === undefined ? 0 : -1; }
    if (b === undefined) { return a === undefined ? 0 : 1; }

    // null
    if (a === null) { return b === null ? 0 : -1; }
    if (b === null) { return a === null ? 0 : 1; }

    for (i = 0, len = fields.length; i < len; i++) {
      comparison = compareThings(a[fields[i]], b[fields[i]]);
      if (comparison !== 0) { return comparison; }
    }

    return 0;
  };
}
function compoundCompareThings (fields) {
  return function (a, b) {
    var i, len, comparison;

    // undefined
    if (a === undefined) { return b === undefined ? 0 : -1; }
    if (b === undefined) { return a === undefined ? 0 : 1; }

    // null
    if (a === null) { return b === null ? 0 : -1; }
    if (b === null) { return a === null ? 0 : 1; }

    for (i = 0, len = fields.length; i < len; i++) {
      comparison = compareThings(a[fields[i]], b[fields[i]]);
      if (comparison !== 0) { return comparison; }
    }

    return 0;
  };
}
function compoundCompareThings ( fields ) { return function ( a , b ) { var i , len , comparison ; // undefined if ( a === undefined ) { return b === undefined ? 0 : - 1 ; } if ( b === undefined ) { return a === undefined ? 0 : 1 ; } // null if ( a === null ) { return b === null ? 0 : - 1 ; } if ( b === null ) { return a === null ? 0 : 1 ; } for ( i = 0 , len = fields . length ; i < len ; i ++ ) { comparison = compareThings ( a [ fields [ i ] ] , b [ fields [ i ] ] ) ; if ( comparison !== 0 ) { return comparison ; } } return 0 ; } ; }
Used primarily in compound indexes. Returns a comparison function usable as
an Index's compareKeys function.
Used primarily in compound indexes . Returns a comparison function usable as an Index s compareKeys function .