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

redux-router-kit

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-router-kit - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

4

package.json
{
"name": "redux-router-kit",
"version": "0.0.2",
"version": "0.0.3",
"description": "Routing tools for Redux/React",

@@ -8,3 +8,3 @@ "main": "lib/index.js",

"test": "ava test",
"prebuild": "mkdir -p lib",
"prebuild": "rm -rf lib && mkdir -p lib",
"build": "babel src --out-dir lib",

@@ -11,0 +11,0 @@ "prepublish": "npm run build",

@@ -42,7 +42,6 @@ import pathToRegExp from 'path-to-regexp';

const mapUrlToRoute = (urlAndQueryString, routes) => {
const mapUrlToRoute = (fullUrl, routes) => {
const querySeparatorIndex = urlAndQueryString.indexOf('?');
const url = urlAndQueryString.substring(0, querySeparatorIndex >= 0 ? querySeparatorIndex : urlAndQueryString.length);
const queryStringAndHash = querySeparatorIndex >= 0 ? urlAndQueryString.substring(querySeparatorIndex) : '';
const urlWithQueryString = fullUrl.split('#')[0];
const url = urlWithQueryString.split('?')[0];

@@ -53,4 +52,4 @@ for (let route in routes) {

if (routeMatch) {
const hashIndex = queryStringAndHash.indexOf('#');
const queryString = hashIndex >= 0 ? queryStringAndHash.split('#')[0] : queryStringAndHash;
const queryStringAndHash = fullUrl.substring(url.length);
const queryString = queryStringAndHash.split('#')[0];
const query = queryStringParser.parse(queryString);

@@ -57,0 +56,0 @@ return {

@@ -44,1 +44,15 @@ import test from 'ava';

});
test('route with hash', t => {
const routeMatch = mapUrlToRoute('/users#joe', routes);
t.is(routeMatch.route, '/users');
});
test('route with hash and query', t => {
const routeMatch = mapUrlToRoute('/users?q=joe#foo', routes);
t.is(routeMatch.route, '/users');
});
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