Comparing version 0.0.9 to 0.0.10
@@ -1,2 +0,1 @@ | ||
/// <reference types="node" /> | ||
import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http'; | ||
@@ -9,2 +8,2 @@ | ||
export default fresh; | ||
export { fresh }; |
@@ -1,1 +0,1 @@ | ||
var CACHE_CONTROL_NO_CACHE_REGEXP=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;var parseHttpDate=Date.parse;var compareETags=(etag,str)=>str===etag||str===`W/${etag}`||`W/${str}`===etag;function isStale(etag,noneMatch){let start=0;let end=0;for(let i=0,len=noneMatch.length;i<len;i++){switch(noneMatch.charCodeAt(i)){case 32:if(start===end)start=end=i+1;break;case 44:if(compareETags(etag,noneMatch.substring(start,end)))return false;start=end=i+1;break;default:end=i+1;break}}if(compareETags(etag,noneMatch.substring(start,end)))return false;return true}function fresh(reqHeaders,resHeaders){const modifiedSince=reqHeaders["if-modified-since"];const noneMatch=reqHeaders["if-none-match"];if(!modifiedSince&&!noneMatch)return false;const cacheControl=reqHeaders["cache-control"];if(cacheControl&&CACHE_CONTROL_NO_CACHE_REGEXP.test(cacheControl)){return false}if(noneMatch&&noneMatch!=="*"){const etag=resHeaders.etag;if(!etag||isStale(etag,noneMatch))return false}if(modifiedSince){const lastModified=resHeaders["last-modified"];if(!lastModified||!(parseHttpDate(lastModified)<=parseHttpDate(modifiedSince))){return false}}return true}export{fresh as default}; | ||
var CACHE_CONTROL_NO_CACHE_REGEXP=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;var parseHttpDate=Date.parse;var compareETags=(etag,str)=>str===etag||str===`W/${etag}`||`W/${str}`===etag;function isStale(etag,noneMatch){let start=0;let end=0;for(let i=0,len=noneMatch.length;i<len;i++){switch(noneMatch.charCodeAt(i)){case 32:if(start===end)start=end=i+1;break;case 44:if(compareETags(etag,noneMatch.substring(start,end)))return false;start=end=i+1;break;default:end=i+1;break}}if(compareETags(etag,noneMatch.substring(start,end)))return false;return true}function fresh(reqHeaders,resHeaders){const modifiedSince=reqHeaders["if-modified-since"];const noneMatch=reqHeaders["if-none-match"];if(!modifiedSince&&!noneMatch)return false;const cacheControl=reqHeaders["cache-control"];if(cacheControl&&CACHE_CONTROL_NO_CACHE_REGEXP.test(cacheControl)){return false}if(noneMatch&&noneMatch!=="*"){const etag=resHeaders.etag;if(!etag||isStale(etag,noneMatch))return false}if(modifiedSince){const lastModified=resHeaders["last-modified"];if(!lastModified||!(parseHttpDate(lastModified)<=parseHttpDate(modifiedSince))){return false}}return true}export{fresh}; |
{ | ||
"name": "es-fresh", | ||
"description": "fresh rewrite in TypeScript with ESM targets", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"repository": "https://github.com/talentlessguy/es-fresh.git", | ||
@@ -27,5 +27,5 @@ "engines": { | ||
"devDependencies": { | ||
"@types/node": "^14.14.11", | ||
"tsup": "^3.10.1", | ||
"typescript": "^4.1.2" | ||
"@types/node": "^15.0.1", | ||
"tsup": "^4.10.1", | ||
"typescript": "^4.2.4" | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
@@ -37,3 +37,3 @@ import { IncomingHttpHeaders, OutgoingHttpHeaders } from 'http' | ||
*/ | ||
export default function fresh( | ||
export function fresh( | ||
reqHeaders: IncomingHttpHeaders, | ||
@@ -40,0 +40,0 @@ resHeaders: OutgoingHttpHeaders |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7254
72