New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-spa-router

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-spa-router - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

20

index.js

@@ -24,2 +24,4 @@ /*!

for (key in defaults) {
if (!defaults.hasOwnProperty(key)) continue;
if (!options[key]) {

@@ -33,4 +35,3 @@ options[key] = defaults[key];

for (i = 0, l = routes.length; i < l; i++) {
regexStr += '(?:' + routes[i] + ')';
if (i !== l - 1) regexStr += '|';
regexStr += '(?:' + routes[i] + ')' + (i !== l - 1 ? '|' : '\/');
}

@@ -43,10 +44,12 @@ options[key] = new RegExp(regexStr);

return function(req, res, next) {
var routes, i, l;
var routes, i, l, url;
url = req.url;
if (url.slice(-1) !== '/') url += '/';
if (req.xhr || req.method !== 'GET' || req.url === '/' ||
options.staticPaths.test(req.url) || options.ignore.test(req.url)) {
if (req.xhr || req.method !== 'GET' || url === '/' ||
options.staticPaths.test(url) || options.ignore.test(url)) {
return next();
}
if (options.extraRoutes.test(req.url)) {
if (options.extraRoutes.test(url)) {
req.url = '/';

@@ -57,4 +60,5 @@ return next();

routes = app.routes.get;
for (i = 0, l = routes.length; i < l; i++) {
if (routes[i].regexp.test(req.url)) {
if (routes[i].regexp.test(url)) {
req.url = '/';

@@ -61,0 +65,0 @@ return next();

3

package.json
{
"name": "express-spa-router",
"version": "0.0.5",
"version": "0.0.6",
"description": "Express middleware for single page app routing",

@@ -14,2 +14,3 @@ "main": "index.js",

},
"keywords": ["express", "router", "spa"],
"license": "MIT",

@@ -16,0 +17,0 @@ "peerDependencies": {

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