From af15bd36e7709d6b7d25ba7b996f306a206b8b4d Mon Sep 17 00:00:00 2001 From: James Smith Date: Mon, 17 Oct 2016 09:08:34 -0700 Subject: [PATCH] 1.3.2 --- CHANGELOG.md | 4 ++++ bower.json | 2 +- dist/backbone.base-router.js | 12 ++++++++---- dist/backbone.base-router.min.js | 4 ++-- dist/backbone.base-router.min.js.map | 2 +- package.json | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ea82b0..89135c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### [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) - Updated dependencies to include the latest Backbone versions. diff --git a/bower.json b/bower.json index 0c8f594..299ddfe 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "backbone.base-router", - "version": "1.3.1", + "version": "1.3.2", "homepage": "https://github.com/jmeas/backbone.base-router", "authors": [ "Jmeas " diff --git a/dist/backbone.base-router.js b/dist/backbone.base-router.js index 3c1470c..4f3eb8a 100644 --- a/dist/backbone.base-router.js +++ b/dist/backbone.base-router.js @@ -1,4 +1,4 @@ -// Backbone.BaseRouter v1.3.0 +// Backbone.BaseRouter v1.3.2 (function(root, factory) { if (typeof define === 'function' && define.amd) { define(['backbone', 'underscore'], function(Backbone, _) { @@ -47,7 +47,9 @@ routeStr = origRoute; } - this.routeParams[origRoute] = _.invoke(routeStr.match(NAMED_PARAM), 'slice', 1); + this.routeParams[origRoute] = _.map(routeStr.match(NAMED_PARAM), function (param) { + return param.slice(1); + }); // Begin setting up our routeData, // based on what we already know. @@ -122,8 +124,10 @@ var routeKeys = this.routeParams[route]; 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; + }, {}); } }); diff --git a/dist/backbone.base-router.min.js b/dist/backbone.base-router.min.js index afb58d2..7ef0819 100644 --- a/dist/backbone.base-router.min.js +++ b/dist/backbone.base-router.min.js @@ -1,4 +1,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 \ No newline at end of file diff --git a/dist/backbone.base-router.min.js.map b/dist/backbone.base-router.min.js.map index 6aaeb18..2a0527a 100644 --- a/dist/backbone.base-router.min.js.map +++ b/dist/backbone.base-router.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["backbone.base-router.js"],"names":["root","factory","define","amd","Backbone","_","exports","require","module","this","NAMED_PARAM","PLUS_SYMBOL","BaseRouter","Router","extend","constructor","routeParams","prototype","apply","arguments","onNavigate","routeData","route","origRoute","linked","routeStr","isRegExp","_routeToRegExp","invoke","match","router","originalRoute","history","fragment","navOptions","_extractParameters","queryString","pop","undefined","query","_getQueryParameters","params","_getNamedParams","uriFragment","reduce","split","memo","param","parts","replace","key","val","decodeURIComponent","isArray","push","length","routeKeys","routeValues","slice","object","zip"],"mappings":";;CACC,SAASA,EAAMC,GACd,GAAsB,kBAAXC,SAAyBA,OA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,EAAME,QAAQtC,EAAa,KAAKkC,MAAM,KAC9CK,EAAMF,EAAM,GACZG,EAAMH,EAAM,EAsBhB,OApBAE,GAAME,mBAAmBF,GACzBC,EAAcb,SAARa,EAAoB,KAAOC,mBAAmBD,GAG/CL,EAAKI,GAMD7C,EAAEgD,QAAQP,EAAKI,IACtBJ,EAAKI,GAAKI,KAAKH,GAMfL,EAAKI,IAAQJ,EAAKI,GAAMC,GAZxBL,EAAKI,GAAOC,EAePL,WAKXJ,gBAAiB,SAASpB,EAAON,GAC/B,IAAKA,EAAYuC,OAAU,QAE3B,IAAIC,GAAY/C,KAAKO,YAAYM,GAC7BmC,EAAczC,EAAY0C,MAAM,EAAGF,EAAUD,OAEjD,OAAOlD,GAAEsD,OAAOtD,EAAEuD,IAAIJ,EAAWC,OAK9BrD,EAASQ","file":"backbone.base-router.min.js"} \ No newline at end of file +{"version":3,"sources":["backbone.base-router.js"],"names":["root","factory","define","amd","Backbone","_","exports","require","module","this","NAMED_PARAM","PLUS_SYMBOL","BaseRouter","Router","extend","constructor","routeParams","prototype","apply","arguments","onNavigate","routeData","route","origRoute","linked","routeStr","isRegExp","_routeToRegExp","map","match","param","slice","router","originalRoute","history","fragment","navOptions","_extractParameters","queryString","pop","undefined","query","_getQueryParameters","params","_getNamedParams","uriFragment","reduce","split","memo","parts","replace","key","val","decodeURIComponent","isArray","push","length","routeKeys","routeValues","zip","obj","opts"],"mappings":";;CACC,SAASA,EAAMC,GACd,GAAsB,kBAAXC,SAAyBA,OAAOC,IACzCD,QAAQ,WAAY,cAAe,SAASE,EAAUC,GACpD,MAAOJ,GAAQG,EAAUC,SAGxB,IAAuB,mBAAZC,SAAyB,CACvC,GAAIF,GAAWG,QAAQ,YACnBF,EAAIE,QAAQ,aAChBC,QAAOF,QAAUL,EAAQG,EAAUC,OAGnCJ,GAAQD,EAAKI,SAAUJ,EAAKK,IAE9BI,KAAM,SAASL,EAAUC,GACzB,YAOA,IAAIK,GAAc,kBAEdC,EAAc,KA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AMC,GAZxBJ,EAAKG,GAAOC,EAePJ,WAKXJ,gBAAiB,SAAStB,EAAON,GAC/B,IAAKA,EAAYwC,OAAU,QAE3B,IAAIC,GAAYhD,KAAKO,YAAYM,GAC7BoC,EAAc1C,EAAYe,MAAM,EAAG0B,EAAUD,OACjD,OAAOnD,GAAEyC,OAAOzC,EAAEsD,IAAIF,EAAWC,GAAc,SAAUE,EAAKC,GAE1D,MADAD,GAAIC,EAAK,IAAMA,EAAK,GACbD,UAMRxD,EAASQ","file":"backbone.base-router.min.js"} \ No newline at end of file diff --git a/package.json b/package.json index 278778b..e97afe8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "backbone.base-router", - "version": "1.3.1", + "version": "1.3.2", "description": "A better starting point for a new Backbone Router.", "main": "dist/backbone.base-router.js", "directories": {