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 3.3.0 to 3.3.1

4

changelog.md

@@ -0,1 +1,5 @@

# 3.3.1
- Fixed a bug where calling `evaluteCurrent('/')` when the current url was `/` wouldn't do anything [#56c207f0](https://github.com/TehShrike/hash-brown-router/commit/56c207f011600722f2a805f88ab2381eb55fde2f)
# 3.3.0

@@ -2,0 +6,0 @@

9

index.js

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

path: chunks.shift(),
queryString: qs.parse(chunks.join(''))
queryString: qs.parse(chunks.join('')),
}

@@ -95,6 +95,7 @@ }

function evaluateCurrentPathOrGoToDefault(routes, hashLocation, reverse, onNotFound, defaultPath) {
const currentLocation = hashLocation.get()
if (currentLocation && currentLocation !== '/') {
var currentLocation = hashLocation.get()
var canUseCurrentLocation = currentLocation && (currentLocation !== '/' || defaultPath === '/')
if (canUseCurrentLocation) {
var routesCopy = routes.slice()
evaluateCurrentPath(routesCopy, hashLocation, reverse, onNotFound)

@@ -101,0 +102,0 @@ } else {

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

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

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

test('evaluateCurrent fires the / route when the url is currently /', function(t) {
t.plan(1)
startTest(function(getRoute) {
var route = getRoute()
route.on('not found', function(path, parameters) {
t.fail('Should not fire the not found route')
route.stop()
t.end()
})
route.add('/', function(parameters) {
t.deepEqual(parameters, {})
route.stop()
t.end()
})
route.evaluateCurrent('/')
}, '/')
t.timeoutAfter(4000)
})
test('replacing a url', function(t) {

@@ -249,0 +275,0 @@ startTest(function(getRoute) {

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