Skip to content

Commit

Permalink
Don't unwrap map instances during route value string coercion.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlundquist committed Feb 11, 2016
1 parent f03e85e commit 4bdce12
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions route/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@ steal('can/util', 'can/map', 'can/list','can/util/string/deparam', function (can
stringify = function (obj) {
// Object is array, plain object, Map or List
if (obj && typeof obj === "object") {
// Get native object or array from Map or List
if (obj instanceof can.Map) {
obj = obj.attr();
// Clone object to prevent change original values
obj = obj;
} else {
// Get array from array-like or shallow-copy object
obj = can.isFunction(obj.slice) ? obj.slice() : can.extend({}, obj);
}
// Convert each object property or array item into stringified new
Expand Down Expand Up @@ -121,10 +120,8 @@ steal('can/util', 'can/map', 'can/list','can/util/string/deparam', function (can
// change type coercion during Map setter to coerce all values to strings
stringCoercingMapDecorator = function(map) {
var typeSuper = map.__type;
map.__type = function(val, prop) {
var newArguments = [stringify(val), prop];

return typeSuper.apply(map, newArguments);
map.__type = function() {
return stringify(typeSuper.apply(map, arguments));
};

return map;
Expand Down

0 comments on commit 4bdce12

Please sign in to comment.