Socket
Socket
Sign inDemoInstall

react-router

Package Overview
Dependencies
Maintainers
2
Versions
518
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router - npm Package Compare versions

Comparing version 0.12.3 to 0.12.4

2

lib/createRouter.js

@@ -169,3 +169,3 @@ "use strict";

match: function match(path) {
return Match.findMatchForPath(this.routes, path);
return Match.findMatch(this.routes, path);
},

@@ -172,0 +172,0 @@

"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) { if (staticProps) Object.defineProperties(child, staticProps); if (instanceProps) Object.defineProperties(child.prototype, instanceProps); };
var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } };
/* jshint -W084 */
var PathUtils = require("./PathUtils");
var Match = function Match(pathname, params, query, routes) {
_classCallCheck(this, Match);
this.pathname = pathname;
this.params = params;
this.query = query;
this.routes = routes;
};
function deepSearch(route, pathname, query) {

@@ -51,17 +43,38 @@ // Check the subtree first to find the most deeply-nested match.

/**
* Attempts to match depth-first a route in the given route's
* subtree against the given path and returns the match if it
* succeeds, null if no match can be made.
*/
Match.findMatchForPath = function (routes, path) {
var pathname = PathUtils.withoutQuery(path);
var query = PathUtils.extractQuery(path);
var match = null;
var Match = (function () {
function Match(pathname, params, query, routes) {
_classCallCheck(this, Match);
for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query);
this.pathname = pathname;
this.params = params;
this.query = query;
this.routes = routes;
}
return match;
};
_prototypeProperties(Match, {
findMatch: {
/**
* Attempts to match depth-first a route in the given route's
* subtree against the given path and returns the match if it
* succeeds, null if no match can be made.
*/
value: function findMatch(routes, path) {
var pathname = PathUtils.withoutQuery(path);
var query = PathUtils.extractQuery(path);
var match = null;
for (var i = 0, len = routes.length; match == null && i < len; ++i) match = deepSearch(routes[i], pathname, query);
return match;
},
writable: true,
configurable: true
}
});
return Match;
})();
module.exports = Match;
{
"name": "react-router",
"version": "0.12.3",
"version": "0.12.4",
"description": "A complete routing library for React.js",

@@ -5,0 +5,0 @@ "main": "lib",

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