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

@tinyhttp/cors

Package Overview
Dependencies
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tinyhttp/cors - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

6

CHANGELOG.md
# @tinyhttp/cors
## 0.2.4
### Patch Changes
- Fix Terser options
## 0.2.3

@@ -4,0 +10,0 @@

2

dist/index.js

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

import{vary as o}from"es-vary";const cors=({origin:e="*",o:s=["GET","HEAD","PUT","PATCH","POST","DELETE"],s:l,l:i,i:t,t:r,A:n=204})=>(c,A,f)=>{if("boolean"==typeof e&&!0===e)A.p("Access-Control-Allow-Origin","*");else if("string"==typeof e)A.p("Access-Control-Allow-Origin",e);else if("function"==typeof e)A.p("Access-Control-Allow-Origin",e(c,A));if("string"==typeof e&&"*"!==e||"function"==typeof e)o(A,"Origin");A.p("Access-Control-Allow-Methods",s.join(", ").toUpperCase());if(l)A.p("Access-Control-Allow-Headers",l);if(i)A.p("Access-Control-Expose-Headers",i);if(t)A.p("Access-Control-Allow-Credentials","true");if(r)A.p("Access-Control-Max-Age",r);if(void 0===f){A.C=n;A.end()}null==f||f()};export{cors};
import{vary as e}from"es-vary";const cors=({origin:o="*",methods:s=["GET","HEAD","PUT","PATCH","POST","DELETE"],allowedHeaders:t,exposedHeaders:r,credentials:l,maxAge:n,optionsSuccessStatus:a=204})=>(c,d,i)=>{"boolean"==typeof o&&!0===o?d.setHeader("Access-Control-Allow-Origin","*"):"string"==typeof o?d.setHeader("Access-Control-Allow-Origin",o):"function"==typeof o&&d.setHeader("Access-Control-Allow-Origin",o(c,d)),("string"==typeof o&&"*"!==o||"function"==typeof o)&&e(d,"Origin"),d.setHeader("Access-Control-Allow-Methods",s.join(", ").toUpperCase()),t&&d.setHeader("Access-Control-Allow-Headers",t),r&&d.setHeader("Access-Control-Expose-Headers",r),l&&d.setHeader("Access-Control-Allow-Credentials","true"),n&&d.setHeader("Access-Control-Max-Age",n),void 0===i&&(d.statusCode=a,d.end()),null==i||i()};export{cors};
{
"name": "@tinyhttp/cors",
"version": "0.2.3",
"version": "0.2.4",
"description": "tinyhttp CORS module",

@@ -5,0 +5,0 @@ "type": "module",

Sorry, the diff of this file is not supported yet

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