From 30e59f5538cb4426a0d2376b4407be9cba425aa9 Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 27 May 2012 22:08:08 +0200 Subject: [PATCH] when passing an array to Ox.values, return a clone, not the original array --- source/Ox/js/Collection.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Ox/js/Collection.js b/source/Ox/js/Collection.js index e75ac5e5..fc823983 100644 --- a/source/Ox/js/Collection.js +++ b/source/Ox/js/Collection.js @@ -313,8 +313,8 @@ Ox.map Transforms the values of an array, object or string objects and strings. > Ox.map([2, 1, 0], function(v, i) { return v == i; }) [false, true, false] - > Ox.map({a: 'a', b: 'a', c: 'a'}, function(v, k) { return v == k; }) - {a: true, b: false, c: false} + > Ox.map({a: 'b', b: 'b', c: 'b'}, function(v, k) { return v == k; }) + {a: false, b: true, c: false} > Ox.map('foo', function(v) { return v.toUpperCase(); }) 'FOO' > Ox.map([,], function(v, i) { return i; }) @@ -537,7 +537,7 @@ Ox.values Returns the values of a collection Ox.values = function(collection) { var ret, type = Ox.typeOf(collection); if (type == 'array') { - ret = collection; + ret = Ox.clone(collection); } else if (type == 'object') { ret = []; Ox.forEach(collection, function(value) {