Permalink
Browse files

Fix the ‘getProperty’ method, it's now safe to use special characters…

… in property name
  • Loading branch information...
Baggz committed Dec 26, 2012
1 parent e6a37c2 commit 54b712dde4059fa13a9278822896c795b20e9347
Showing with 5 additions and 4 deletions.
  1. +5 −4 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;
+ }
};

0 comments on commit 54b712d

Please sign in to comment.