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

can-route

Package Overview
Dependencies
Maintainers
6
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-route - npm Package Compare versions

Comparing version 3.2.2 to 3.2.3

5

can-route.js

@@ -195,7 +195,8 @@ /*jshint -W079 */

var keys = names.concat(Object.keys(defaults)).sort();
var sameMapKeys = !diff(existingKeys, keys).length;
var sameDefaultValues = !diffObject(r.defaults, defaults).length;
//the regex removes the trailing slash
var matchingRoutesWithoutTrailingSlash = r.route.replace(/\/$/, "") === url.replace(/\/$/, "");
if (sameMapKeys && sameDefaultValues) {
if (sameMapKeys && sameDefaultValues && !matchingRoutesWithoutTrailingSlash) {
dev.warn('two routes were registered with matching keys:\n' +

@@ -202,0 +203,0 @@ '\t(1) route("' + r.route + '", ' + JSON.stringify(r.defaults) + ')\n' +

4

package.json
{
"name": "can-route",
"version": "3.2.2",
"version": "3.2.3",
"description": "",

@@ -55,6 +55,6 @@ "homepage": "",

"devDependencies": {
"can-stache-key": "^0.0.4",
"can-define": "^1.3.3",
"can-list": "^3.2.0",
"can-map": "^3.3.1",
"can-stache-key": "^0.1.0",
"done-serve": "^0.2.0",

@@ -61,0 +61,0 @@ "jshint": "^2.9.1",

@@ -1124,2 +1124,29 @@ /* jshint asi:true */

test("should not be display warning for matching keys when the routes do not match (#99)", function () {
expect(1);
var oldlog = dev.warn;
var expectedWarningText = 'two routes were registered with matching keys:\n' +
'\t(1) route("login", {"page":"auth"})\n' +
'\t(2) route("signup", {"page":"auth"})\n' +
'(1) will always be chosen since it was registered first';
dev.warn = function(text) {
ok(text === expectedWarningText, text)
};
//should warn
canRoute("login", { "page":"auth" });
canRoute("signup", { "page":"auth" });
//should not warn
canRoute("login2/", { "page":"auth2" });
canRoute("login2", { "page":"auth2" });
//should not warn
canRoute("login3", { "page":"auth3" });
canRoute("login3", { "page":"auth3" });
dev.warn = oldlog;
});
test("setting route.data with the same map doesn't add the decorator function multiple times", function () {

@@ -1126,0 +1153,0 @@ var oldData = canRoute.data;

Sorry, the diff of this file is not supported yet

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