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.5.2 to 1.5.3

6

index.js

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

stop: stop,
evaluateCurrent: evaluateCurrentPathOrGoToDefault.bind(null, routes, hashLocation),
evaluateCurrent: evaluateCurrentPathOrGoToDefault.bind(null, routes, hashLocation, !!opts.reverse),
setDefault: setDefault.bind(null, routes),

@@ -90,3 +90,3 @@ replace: hashLocation.replace,

function evaluateCurrentPathOrGoToDefault(routes, hashLocation, defaultPath) {
function evaluateCurrentPathOrGoToDefault(routes, hashLocation, reverse, defaultPath) {
if (hashLocation.get()) {

@@ -97,3 +97,3 @@ var routesCopy = routes.slice()

}
evaluateCurrentPath(routesCopy, hashLocation)
evaluateCurrentPath(routesCopy, hashLocation, reverse)
} else {

@@ -100,0 +100,0 @@ hashLocation.go(defaultPath)

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

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -297,2 +297,28 @@ var makeRouter = require('../')

})
test('reverse order is respected for evaluateCurrent()', function(t) {
// https://github.com/TehShrike/hash-brown-router/issues/8
getRoute(function(route) {
locationHash.go('/route/butts')
route.add('/route/:oneThing', function() {
t.fail('the first route was called')
route.stop()
t.end()
})
route.add('/route/:anotherThing', function() {
t.pass('the second route was called')
route.stop()
t.end()
})
setTimeout(function() {
route.evaluateCurrent('/wat')
}, 50)
}, { reverse: true })
t.timeoutAfter(4000)
})
}
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