another-json-schema
Advanced tools
Comparing version 1.1.5 to 1.2.0
14
index.js
@@ -16,7 +16,5 @@ 'use strict'; | ||
var helpers = {}; | ||
AJS.register = function register(name, fn) { | ||
if (!name || !fn) throw new TypeError('Missing name or fn'); | ||
helpers[name] = fn; | ||
helpersFuncs[name] = fn; | ||
}; | ||
@@ -184,3 +182,3 @@ | ||
function validate(value, currentKey, parentNode) { | ||
var valid = helpers.type.call(ctx, value, ctx._children.type, currentKey, parentNode); | ||
var valid = helpersFuncs.type.call(ctx, value, ctx._children.type, currentKey, parentNode); | ||
if (!valid) { | ||
@@ -192,6 +190,6 @@ error = genError(value, ctx, 'type'); | ||
for (var helper in ctx._children) { | ||
if (!valid || 'type' === helper || !helpers[helper] || (opts[helper] !== undefined && !opts[helper])) { | ||
if (!valid || 'type' === helper || !helpersFuncs[helper] || (opts[helper] !== undefined && !opts[helper])) { | ||
continue; | ||
} | ||
valid = helpers[helper].call(ctx, value, ctx._children[helper], currentKey, parentNode); | ||
valid = helpersFuncs[helper].call(ctx, value, ctx._children[helper], currentKey, parentNode); | ||
if (!valid) { | ||
@@ -237,5 +235,1 @@ error = genError(value, ctx, helper); | ||
module.exports.helpers = helpersFuncs; | ||
Object.keys(helpersFuncs).forEach(function (helper) { | ||
AJS.register(helper, helpersFuncs[helper]); | ||
}); |
{ | ||
"name": "another-json-schema", | ||
"version": "1.1.5", | ||
"version": "1.2.0", | ||
"description": "Another JSON Schema, simple & flexible & intuitive.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32189
882