Skip to content

Commit 1988c3f

Browse files
committed
Rename var
1 parent 7160146 commit 1988c3f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

index.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -342,12 +342,12 @@ module.exports = class CachePolicy {
342342
}
343343

344344
_serverDate() {
345-
const dateValue = Date.parse(this._resHeaders.date);
346-
if (isFinite(dateValue)) {
345+
const serverDate = Date.parse(this._resHeaders.date);
346+
if (isFinite(serverDate)) {
347347
const maxClockDrift = 8 * 3600 * 1000;
348-
const clockDrift = Math.abs(this._responseTime - dateValue);
348+
const clockDrift = Math.abs(this._responseTime - serverDate);
349349
if (clockDrift < maxClockDrift) {
350-
return dateValue;
350+
return serverDate;
351351
}
352352
}
353353
return this._responseTime;
@@ -419,22 +419,22 @@ module.exports = class CachePolicy {
419419

420420
const defaultMinTtl = this._rescc.immutable ? this._immutableMinTtl : 0;
421421

422-
const dateValue = this._serverDate();
422+
const serverDate = this._serverDate();
423423
if (this._resHeaders.expires) {
424424
const expires = Date.parse(this._resHeaders.expires);
425425
// A cache recipient MUST interpret invalid date formats, especially the value "0", as representing a time in the past (i.e., "already expired").
426-
if (Number.isNaN(expires) || expires < dateValue) {
426+
if (Number.isNaN(expires) || expires < serverDate) {
427427
return 0;
428428
}
429-
return Math.max(defaultMinTtl, (expires - dateValue) / 1000);
429+
return Math.max(defaultMinTtl, (expires - serverDate) / 1000);
430430
}
431431

432432
if (this._resHeaders['last-modified']) {
433433
const lastModified = Date.parse(this._resHeaders['last-modified']);
434-
if (isFinite(lastModified) && dateValue > lastModified) {
434+
if (isFinite(lastModified) && serverDate > lastModified) {
435435
return Math.max(
436436
defaultMinTtl,
437-
((dateValue - lastModified) / 1000) * this._cacheHeuristic
437+
((serverDate - lastModified) / 1000) * this._cacheHeuristic
438438
);
439439
}
440440
}

0 commit comments

Comments
 (0)