kriasoft / universal-router

A simple middleware-style router for isomorphic JavaScript web apps
https://www.kriasoft.com/universal-router/
MIT License
1.7k stars 104 forks source link

Allow any string to be a valid route name #145

Closed isymchych closed 6 years ago

isymchych commented 6 years ago

Right its not possible to use route names which are equal to properties in Object.prototype. Its important because Firefox still has Object.prototype.watch property.

So to avoid naming collisions Object.create(null) should be used instead of object literal.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 45a98dd98c59d786dfd090845267ad113ae88a35 on isymchych:master into 6b7b16ce0f78434c89393f4e1e44ac98aedb2e54 on kriasoft:master.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 45a98dd98c59d786dfd090845267ad113ae88a35 on isymchych:master into 6b7b16ce0f78434c89393f4e1e44ac98aedb2e54 on kriasoft:master.

frenzzy commented 6 years ago

Is it throw errors right now? Maybe we should use Map instead?

isymchych commented 6 years ago

@frenzzy yep (I've added test case for this issue)

I agree that Map would be more idiomatic solution, going to update PR

UPD: removed test as it makes less sence if we use Map

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 454bcef8b90aa11cab4cbe3badfbcb1f14c9a753 on isymchych:master into 6b7b16ce0f78434c89393f4e1e44ac98aedb2e54 on kriasoft:master.

frenzzy commented 6 years ago

Thank you!