between: function()

in public/dexie.js [3608:3638]


        between: function (lower, upper, includeLower, includeUpper) {
          /// <summary>
          ///     Filter out records whose where-field lays between given lower and upper values. Applies to Strings, Numbers and Dates.
          /// </summary>
          /// <param name="lower"></param>
          /// <param name="upper"></param>
          /// <param name="includeLower" optional="true">Whether items that equals lower should be included. Default true.</param>
          /// <param name="includeUpper" optional="true">Whether items that equals upper should be included. Default false.</param>
          /// <returns type="Collection"></returns>
          includeLower = includeLower !== false; // Default to true
          includeUpper = includeUpper === true; // Default to false
          try {
            if (
              cmp(lower, upper) > 0 ||
              (cmp(lower, upper) === 0 &&
                (includeLower || includeUpper) &&
                !(includeLower && includeUpper))
            )
              return emptyCollection(this); // Workaround for idiotic W3C Specification that DataError must be thrown if lower > upper. The natural result would be to return an empty collection.
            return new Collection(this, function () {
              return IDBKeyRange.bound(
                lower,
                upper,
                !includeLower,
                !includeUpper
              );
            });
          } catch (e) {
            return fail(this, INVALID_KEY_ARGUMENT);
          }
        },