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

baobab-router

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

baobab-router - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

43

baobab-router.dist.js

@@ -359,10 +359,12 @@ 'use strict';

* @param {regexp} solver The solver to use.
* @param {?object} baseState The optional base state, ie the recursively
* merged state of the route's parents.
* @param {?object} baseTree The optional base state, ie the recursively
* merged state of the route's ancestors.
* @param {?object} baseQuery The optional base query, ie the recursively
* merged query of the route's ancestors.
* @param {?string} basePath The optional base path, ie the recursively
* concatenated path of the route's parents.
* concatenated path of the route's ancestors.
* @return {route} The well-formed route object.
*/
function __makeRoutes(route, solver, baseTree) {
var basePath = arguments.length <= 3 || arguments[3] === undefined ? '' : arguments[3];
function __makeRoutes(route, solver, baseTree, baseQuery) {
var basePath = arguments.length <= 4 || arguments[4] === undefined ? '' : arguments[4];

@@ -380,16 +382,17 @@ var _deepMerge = __deepMerge(baseTree || {}, route.state ? { state: route.state } : {});

route.queryValues = [];
for (var k in route.query || {}) {
if (route.query.hasOwnProperty(k)) {
if (typeof route.query[k] === 'string') {
route.query[k] = {
match: route.query[k]
route.fullQuery = __deepMerge(baseQuery || {}, route.query || {}).value;
route.fullQueryValues = [];
for (var k in route.fullQuery || {}) {
if (route.fullQuery.hasOwnProperty(k)) {
if (typeof route.fullQuery[k] === 'string') {
route.fullQuery[k] = {
match: route.fullQuery[k]
};
}
route.queryValues.push(route.query[k].match);
route.fullQueryValues.push(route.fullQuery[k].match);
}
}
route.updates = __extractPaths(route.fullTree, route.dynamics.concat(route.queryValues));
route.updates = __extractPaths(route.fullTree, route.dynamics.concat(route.fullQueryValues));

@@ -402,3 +405,3 @@ if (route.defaultRoute) {

route.routes = route.routes.map(function (child) {
return __makeRoutes(child, solver, route.fullTree, route.fullPath);
return __makeRoutes(child, solver, route.fullTree, route.fullQuery, route.fullPath);
});

@@ -522,3 +525,3 @@ }

var arr = str.split('=');
var queryObj = (route.query || {})[unescape(arr[0])] || {};
var queryObj = (route.fullQuery || {})[unescape(arr[0])] || {};
var value = unescape(arr[1]);

@@ -618,3 +621,3 @@

// Check if route match:
var match = baseTree ? __doesStateMatch(tree, route.fullTree, route.dynamics, route.queryValues) : __doesStateMatch(route.fullTree, tree, route.dynamics, route.queryValues);
var match = baseTree ? __doesStateMatch(tree, route.fullTree, route.dynamics, route.fullQueryValues) : __doesStateMatch(route.fullTree, tree, route.dynamics, route.fullQueryValues);

@@ -670,5 +673,5 @@ if (!match && arguments.length > 0 && !route.overrides) {

for (var k in route.query) {
if (route.query.hasOwnProperty(k)) {
query[k] = match[route.query[k].match];
for (var k in route.fullQuery) {
if (route.fullQuery.hasOwnProperty(k)) {
query[k] = match[route.fullQuery[k].match];
}

@@ -769,3 +772,3 @@ }

// Baobab-Router version:
BaobabRouter.version = '2.2.1';
BaobabRouter.version = '2.2.2';

@@ -772,0 +775,0 @@ // Expose private methods for unit testing:

@@ -378,12 +378,15 @@ /**

* @param {regexp} solver The solver to use.
* @param {?object} baseState The optional base state, ie the recursively
* merged state of the route's parents.
* @param {?object} baseTree The optional base state, ie the recursively
* merged state of the route's ancestors.
* @param {?object} baseQuery The optional base query, ie the recursively
* merged query of the route's ancestors.
* @param {?string} basePath The optional base path, ie the recursively
* concatenated path of the route's parents.
* concatenated path of the route's ancestors.
* @return {route} The well-formed route object.
*/
function __makeRoutes(route, solver, baseTree, basePath = '') {
function __makeRoutes(route, solver, baseTree, baseQuery, basePath = '') {
const { value, conflicts } = __deepMerge(
baseTree || {},
route.state ? { state: route.state } : {});
route.state ? { state: route.state } : {}
);

@@ -395,12 +398,13 @@ route.fullPath = __concatenatePaths(basePath, route.path);

route.queryValues = [];
for (const k in route.query || {}) {
if (route.query.hasOwnProperty(k)) {
if (typeof route.query[k] === 'string') {
route.query[k] = {
match: route.query[k],
route.fullQuery = __deepMerge(baseQuery || {}, route.query || {}).value;
route.fullQueryValues = [];
for (const k in route.fullQuery || {}) {
if (route.fullQuery.hasOwnProperty(k)) {
if (typeof route.fullQuery[k] === 'string') {
route.fullQuery[k] = {
match: route.fullQuery[k],
};
}
route.queryValues.push(route.query[k].match);
route.fullQueryValues.push(route.fullQuery[k].match);
}

@@ -411,3 +415,3 @@ }

route.fullTree,
route.dynamics.concat(route.queryValues)
route.dynamics.concat(route.fullQueryValues)
);

@@ -426,2 +430,3 @@

route.fullTree,
route.fullQuery,
route.fullPath

@@ -564,3 +569,3 @@ )

const arr = str.split('=');
const queryObj = (route.query || {})[unescape(arr[0])] || {};
const queryObj = (route.fullQuery || {})[unescape(arr[0])] || {};
let value = unescape(arr[1]);

@@ -661,4 +666,14 @@

const match = baseTree ?
__doesStateMatch(tree, route.fullTree, route.dynamics, route.queryValues) :
__doesStateMatch(route.fullTree, tree, route.dynamics, route.queryValues);
__doesStateMatch(
tree,
route.fullTree,
route.dynamics,
route.fullQueryValues
) :
__doesStateMatch(
route.fullTree,
tree,
route.dynamics,
route.fullQueryValues
);

@@ -715,5 +730,5 @@ if (!match && arguments.length > 0 && !route.overrides) {

for (const k in route.query) {
if (route.query.hasOwnProperty(k)) {
query[k] = match[route.query[k].match];
for (const k in route.fullQuery) {
if (route.fullQuery.hasOwnProperty(k)) {
query[k] = match[route.fullQuery[k].match];
}

@@ -835,3 +850,3 @@ }

// Baobab-Router version:
BaobabRouter.version = '2.2.1';
BaobabRouter.version = '2.2.2';

@@ -838,0 +853,0 @@ // Expose private methods for unit testing:

{
"name": "baobab-router",
"version": "2.2.1",
"version": "2.2.2",
"description": "A router for Baobab",

@@ -5,0 +5,0 @@ "main": "baobab-router.dist.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