function calculateEffectiveBoundaries()

in workbox-v4.3.1/workbox-range-requests.dev.js [27:65]


  function calculateEffectiveBoundaries(blob, start, end) {
    {
      assert_mjs.assert.isInstance(blob, Blob, {
        moduleName: 'workbox-range-requests',
        funcName: 'calculateEffectiveBoundaries',
        paramName: 'blob'
      });
    }

    const blobSize = blob.size;

    if (end > blobSize || start < 0) {
      throw new WorkboxError_mjs.WorkboxError('range-not-satisfiable', {
        size: blobSize,
        end,
        start
      });
    }

    let effectiveStart;
    let effectiveEnd;

    if (start === null) {
      effectiveStart = blobSize - end;
      effectiveEnd = blobSize;
    } else if (end === null) {
      effectiveStart = start;
      effectiveEnd = blobSize;
    } else {
      effectiveStart = start; // Range values are inclusive, so add 1 to the value.

      effectiveEnd = end + 1;
    }

    return {
      start: effectiveStart,
      end: effectiveEnd
    };
  }