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

corsable

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

corsable - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

20

index.js

@@ -33,12 +33,18 @@ 'use strict';

const origin_header_value = request.headers && request.headers.originl;
const has_origin_header = typeof origin_header_value === 'string';
let origin = null;
if ( options.origin instanceof RegExp ) {
origin = options.origin.test( request.headers && request.headers.origin ) ? request.headers.origin : null;
if ( typeof options.origin === 'string' ) {
origin = options.origin;
}
else if ( Array.isArray( options.origin ) ) {
origin = options.origin.includes( request.headers && request.headers.origin ) ? request.headers.origin : null;
else if ( has_origin_header ) {
if ( options.origin instanceof RegExp ) {
origin = options.origin.test( origin_header_value ) ? origin_header_value : null;
}
else if ( Array.isArray( options.origin ) ) {
origin = options.origin.includes( origin_header_value ) ? origin_header_value : null;
}
}
else if ( typeof options.origin === 'string' ) {
origin = options.origin;
}

@@ -45,0 +51,0 @@ if ( origin !== null ) {

{
"name": "corsable",
"version": "2.0.0",
"version": "2.0.1",
"description": "lightweight CORS",

@@ -5,0 +5,0 @@ "main": "index.js",

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