another-json-schema
Advanced tools
+4
-10
@@ -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]); | ||
| }); |
+1
-1
| { | ||
| "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", |
32189
-0.32%882
-0.45%