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

hash-brown-router

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hash-brown-router - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

23

index.js

@@ -5,2 +5,3 @@ var pathToRegexp = require('path-to-regexp-with-reversible-keys')

var browserHashLocation = require('./hash-location.js')
require('array.prototype.find')

@@ -47,23 +48,11 @@ module.exports = function Router(hashLocation) {

path = pathParts.path
var queryStringParameters = pathParts.queryString
var matchingRoute = routes.reduce(function(found, route) {
if (found) {
return found
} else {
var matchingRegex = route.exec(path)
if (matchingRegex) {
return {
regexResult: matchingRegex,
route: route
}
}
}
}, null)
var matchingRoute = routes.find("".match, path)
var queryStringParameters = pathParts.queryString
if (matchingRoute) {
var routeParameters = makeParametersObjectFromRegexResult(matchingRoute.route.keys, matchingRoute.regexResult)
var regexResult = matchingRoute.exec(path)
var routeParameters = makeParametersObjectFromRegexResult(matchingRoute.keys, regexResult)
var params = xtend(queryStringParameters, routeParameters)
matchingRoute.route.fn(params)
matchingRoute.fn(params)
} else if (routes.defaultFn) {

@@ -70,0 +59,0 @@ routes.defaultFn(path, queryStringParameters)

{
"name": "hash-brown-router",
"version": "1.3.0",
"version": "1.3.1",
"description": "A client-side router that only cares about the bits after the #",

@@ -29,9 +29,9 @@ "main": "index.js",

"domready": "^1.0.7",
"path-to-regexp-with-reversible-keys": "^1.0.1",
"tap-browser-color": "^0.1.2",
"tape": "^3.0.1",
"xtend": "^4.0.0"
"tape": "^3.0.1"
},
"dependencies": {
"path-to-regexp-with-reversible-keys": "^1.0.1"
"array.prototype.find": "^1.0.0",
"path-to-regexp-with-reversible-keys": "^1.0.1",
"xtend": "^4.0.0"
},

@@ -38,0 +38,0 @@ "testling": {

A router that is only concerned with single-page apps that want to change state based on the bits of the url after the hash.
[![browser support](https://ci.testling.com/TehShrike/hash-brown-router.png)](https://ci.testling.com/TehShrike/hash-brown-router)
[![Build Status](https://travis-ci.org/TehShrike/hash-brown-router.svg)](https://travis-ci.org/TehShrike/hash-brown-router)

@@ -6,0 +6,0 @@ ## To use

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