From a7ffd28fec0f730ef2fa34cdb90843a7cb32f05b Mon Sep 17 00:00:00 2001 From: Quentin Roy Date: Sun, 17 Aug 2014 02:22:44 +0200 Subject: [PATCH] Do not use each function on options.value parameter of MapConstraint to avoid breaking if it contains "length". --- src/map.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/map.js b/src/map.js index 1517d60..dc634c3 100644 --- a/src/map.js +++ b/src/map.js @@ -54,12 +54,14 @@ MapConstraint = function (options) { each(options.keys, function(key) { set_keys[key] = true; }); // Append all of the keys and values passed to the keys and values arrays - each(options.value, function (v, k) { - if(!set_keys[k]) { - options.keys.push(k); - options.values.push(v); - } - }, this); + // Do not use each function to avoid breaking if options.value contains "length" + for (var k in options.value) { + if (!set_keys[k] && hOP.call(options.value, k)) { + var v = options.value[k]; + options.keys.push(k); + options.values.push(v); + } + } set_keys = false;