From 54b712dde4059fa13a9278822896c795b20e9347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frantis=CC=8Cek=20Ha=CC=81ba?= Date: Wed, 26 Dec 2012 15:56:02 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20the=20=E2=80=98getProperty=E2=80=99=20met?= =?UTF-8?q?hod,=20it's=20now=20safe=20to=20use=20special=20characters=20in?= =?UTF-8?q?=20property=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/engines/json/getProperty.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/engines/json/getProperty.js b/src/engines/json/getProperty.js index 9601e1a..2167d3a 100644 --- a/src/engines/json/getProperty.js +++ b/src/engines/json/getProperty.js @@ -5,8 +5,9 @@ * @param {object} source */ Validation.prototype.getProperty = function(property, source) { - var tree = property.match(/([a-zA-Z0-9\s]+)/g); - return tree.reduce(function(previousValue, currentValue, index) { - return (previousValue && isDefined(previousValue[currentValue])) ? previousValue[currentValue] : undefined; - }, source); + if (source) { + return (source[property]) ? source[property] : undefined; + } else { + return undefined; + } }; \ No newline at end of file