Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

es-fresh

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-fresh - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

2

dist/index.js

@@ -1,1 +0,1 @@

const CACHE_CONTROL_NO_CACHE_REGEXP=/(?:^|,)\s*?no-cache\s*?(?:,|$)/;const parseHttpDate=Date.parse;const 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!1;start=end=i+1;break;default:end=i+1;break}}if(compareETags(etag,noneMatch.substring(start,end)))return!1;return!0}function fresh(reqHeaders,resHeaders){const modifiedSince=reqHeaders["if-modified-since"];const noneMatch=reqHeaders["if-none-match"];if(!modifiedSince&&!noneMatch)return!1;const cacheControl=reqHeaders["cache-control"];if(cacheControl&&CACHE_CONTROL_NO_CACHE_REGEXP.test(cacheControl)){return!1}if(noneMatch&&noneMatch!=="*"){const etag=resHeaders.etag;if(!etag||isStale(etag,noneMatch))return!1}if(modifiedSince){const lastModified=resHeaders["last-modified"];if(!lastModified||!(parseHttpDate(lastModified)<=parseHttpDate(modifiedSince))){return!1}}return!0}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 as default};
{
"name": "es-fresh",
"description": "fresh rewrite in TypeScript with ESM and CommonJS targets",
"version": "0.0.8",
"repository": "https://github.com/talentlessguy/es-fresh.git",
"engines": {
"node": ">=12.x"
},
"files": [
"dist",
"src"
],
"author": "talentlessguy <pilll.PL22@gmail.com>",
"license": "MIT",
"type": "module",
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./package.json": "./package.json",
"./": "./"
},
"devDependencies": {
"@types/node": "^14.6.0",
"tsup": "^3.6.1",
"typescript": "^4.0.2"
},
"scripts": {
"prepare": "pnpm build",
"build": "tsup src/index.ts --minify-whitespace --format cjs,esm --dts"
}
"name": "es-fresh",
"description": "fresh rewrite in TypeScript with ESM targets",
"version": "0.0.9",
"repository": "https://github.com/talentlessguy/es-fresh.git",
"engines": {
"node": ">=12.x"
},
"files": [
"dist",
"src"
],
"author": "talentlessguy <pilll.PL22@gmail.com>",
"license": "MIT",
"type": "module",
"main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"exports": {
".": {
"import": "./dist/index.js"
},
"./package.json": "./package.json",
"./": "./"
},
"devDependencies": {
"@types/node": "^14.14.11",
"tsup": "^3.10.1",
"typescript": "^4.1.2"
},
"scripts": {
"build": "tsup src/index.ts --minify-whitespace --format esm --dts"
}
}
# es-fresh
[![Subscribe to twitter][twitter-image]][twitter-url]
![Top language][top-lang-image]

@@ -72,4 +71,2 @@ ![Vulnerabilities][snyk-image]

[twitter-image]: https://img.shields.io/twitter/follow/v1rtl.svg?label=follow%20on%20twitter&style=flat-square
[twitter-url]: https://twitter.com/v1rtl
[node-version-image]: https://img.shields.io/node/v/es-fresh.svg?style=flat-square

@@ -76,0 +73,0 @@ [node-version-url]: https://nodejs.org

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc