Skip to content

Commit

Permalink
Fixed patternProperties implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
iclanzan committed Dec 28, 2013
1 parent eb2d852 commit 89b0fd7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/jassi.js
Expand Up @@ -173,7 +173,7 @@ var validate = function(instance, schema, path) {
}

keys(instance).forEach(function(key) {
var schemas, match, dependency;
var schemas, dependency;

if (schema.dependencies && (dependency = schema.dependencies[key])) {
if (isArray(dependency)) {
Expand All @@ -200,8 +200,13 @@ var validate = function(instance, schema, path) {
schemas = [];
if (properties && properties.hasOwnProperty(key))
schemas.push(properties[key]);
if (pp && pp.some(function(regex) { return key.match(regex) && (match = pp[regex]); }))
schemas.push(match);

pp && pp.forEach(function(regex) {
if (key.match(regex) && pattern[regex]) {
schemas.push(pattern[regex]);
}
});

if (!schemas.length && additional)
schemas.push(additional);

Expand Down

0 comments on commit 89b0fd7

Please sign in to comment.