backbone.base-router
Advanced tools
Comparing version 1.3.1 to 1.3.2
{ | ||
"name": "backbone.base-router", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"homepage": "https://github.com/jmeas/backbone.base-router", | ||
@@ -5,0 +5,0 @@ "authors": [ |
@@ -0,1 +1,5 @@ | ||
### [1.3.2](https://github.com/jmeas/backbone.base-router/releases/tag/1.3.2) | ||
- Update to support Lodash v4 | ||
### [1.3.1](https://github.com/jmeas/backbone.base-router/releases/tag/1.3.1) | ||
@@ -2,0 +6,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Backbone.BaseRouter v1.3.0 | ||
// Backbone.BaseRouter v1.3.2 | ||
(function(root, factory) { | ||
@@ -50,3 +50,5 @@ if (typeof define === 'function' && define.amd) { | ||
this.routeParams[origRoute] = _.invoke(routeStr.match(NAMED_PARAM), 'slice', 1); | ||
this.routeParams[origRoute] = _.map(routeStr.match(NAMED_PARAM), function (param) { | ||
return param.slice(1); | ||
}); | ||
@@ -126,4 +128,6 @@ // Begin setting up our routeData, | ||
var routeValues = routeParams.slice(0, routeKeys.length); | ||
return _.object(_.zip(routeKeys, routeValues)); | ||
return _.reduce(_.zip(routeKeys, routeValues), function (obj, opts) { | ||
obj[opts[0]] = opts[1]; | ||
return obj; | ||
}, {}); | ||
} | ||
@@ -130,0 +134,0 @@ }); |
@@ -1,4 +0,4 @@ | ||
// Backbone.BaseRouter v1.3.0 | ||
// Backbone.BaseRouter v1.3.2 | ||
!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(a,c){return b(a,c)});else if("undefined"!=typeof exports){var c=require("backbone"),d=require("underscore");module.exports=b(c,d)}else b(a.Backbone,a._)}(this,function(a,b){"use strict";var c=/(\(\?)?[:*]\w+/g,d=/\+/g;return a.BaseRouter=a.Router.extend({constructor:function(){this.routeParams={},a.Router.prototype.constructor.apply(this,arguments)},onNavigate:function(a){},route:function(d,e){var f,g;b.isRegExp(d)?(f=d,g=""+d):(f=this._routeToRegExp(d),g=d),this.routeParams[d]=b.invoke(g.match(c),"slice",1);var h={route:f,router:this,linked:e};b.isRegExp(d)||(h.originalRoute=d);var i=this;return a.history.route(f,function(a,b){var c=i._extractParameters(f,a),d=c.pop();b&&(h.navOptions=b),h.queryString=d?d:void 0,h.query=i._getQueryParameters(d),h.params=i._getNamedParams(g,c),h.uriFragment=a,i.onNavigate(h)}),this},_getQueryParameters:function(a){return a?b.reduce(a.split("&"),function(a,c){var e=c.replace(d," ").split("="),f=e[0],g=e[1];return f=decodeURIComponent(f),g=void 0===g?null:decodeURIComponent(g),a[f]?b.isArray(a[f])?a[f].push(g):a[f]=[a[f],g]:a[f]=g,a},{}):{}},_getNamedParams:function(a,c){if(!c.length)return{};var d=this.routeParams[a],e=c.slice(0,d.length);return b.object(b.zip(d,e))}}),a.BaseRouter}); | ||
!function(a,b){if("function"==typeof define&&define.amd)define(["backbone","underscore"],function(a,c){return b(a,c)});else if("undefined"!=typeof exports){var c=require("backbone"),d=require("underscore");module.exports=b(c,d)}else b(a.Backbone,a._)}(this,function(a,b){"use strict";var c=/(\(\?)?[:*]\w+/g,d=/\+/g;return a.BaseRouter=a.Router.extend({constructor:function(){this.routeParams={},a.Router.prototype.constructor.apply(this,arguments)},onNavigate:function(a){},route:function(d,e){var f,g;b.isRegExp(d)?(f=d,g=""+d):(f=this._routeToRegExp(d),g=d),this.routeParams[d]=b.map(g.match(c),function(a){return a.slice(1)});var h={route:f,router:this,linked:e};b.isRegExp(d)||(h.originalRoute=d);var i=this;return a.history.route(f,function(a,b){var c=i._extractParameters(f,a),d=c.pop();b&&(h.navOptions=b),h.queryString=d?d:void 0,h.query=i._getQueryParameters(d),h.params=i._getNamedParams(g,c),h.uriFragment=a,i.onNavigate(h)}),this},_getQueryParameters:function(a){return a?b.reduce(a.split("&"),function(a,c){var e=c.replace(d," ").split("="),f=e[0],g=e[1];return f=decodeURIComponent(f),g=void 0===g?null:decodeURIComponent(g),a[f]?b.isArray(a[f])?a[f].push(g):a[f]=[a[f],g]:a[f]=g,a},{}):{}},_getNamedParams:function(a,c){if(!c.length)return{};var d=this.routeParams[a],e=c.slice(0,d.length);return b.reduce(b.zip(d,e),function(a,b){return a[b[0]]=b[1],a},{})}}),a.BaseRouter}); | ||
//# sourceMappingURL=backbone.base-router.min.js.map |
{ | ||
"name": "backbone.base-router", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "A better starting point for a new Backbone Router.", | ||
@@ -5,0 +5,0 @@ "main": "dist/backbone.base-router.js", |
@@ -32,3 +32,5 @@ // | ||
this.routeParams[origRoute] = _.invoke(routeStr.match(NAMED_PARAM), 'slice', 1); | ||
this.routeParams[origRoute] = _.map(routeStr.match(NAMED_PARAM), function (param) { | ||
return param.slice(1); | ||
}); | ||
@@ -108,5 +110,7 @@ // Begin setting up our routeData, | ||
var routeValues = routeParams.slice(0, routeKeys.length); | ||
return _.object(_.zip(routeKeys, routeValues)); | ||
return _.reduce(_.zip(routeKeys, routeValues), function (obj, opts) { | ||
obj[opts[0]] = opts[1]; | ||
return obj; | ||
}, {}); | ||
} | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
57317
982