commonform-validate
Advanced tools
Comparing version 1.0.0 to 1.0.1
24
index.js
@@ -92,6 +92,8 @@ /* Copyright 2015 Kyle E. Mitchell | ||
var child = exports.child = function (argument) { | ||
var child = exports.child = function (argument, options) { | ||
return ( | ||
object(argument) && | ||
hasProperty(argument, 'form', form) && | ||
hasProperty(argument, 'form', function (argument) { | ||
return form(argument, options) | ||
}) && | ||
( | ||
@@ -169,15 +171,11 @@ keyCount(argument) === 1 || | ||
var content = exports.content = (function () { | ||
var content = exports.content = function (argument, options) { | ||
var predicates = [blank, child, definition, reference, text, use] | ||
return function (argument, options) { | ||
return ( | ||
(options && options.allowComponents) | ||
? predicates.concat(component) | ||
: predicates | ||
).some(function (predicate) { | ||
return predicate(argument) | ||
}) | ||
if (options && options.allowComponents) { | ||
predicates.push(component) | ||
} | ||
})() | ||
return predicates.some(function (predicate) { | ||
return predicate(argument, options) | ||
}) | ||
} | ||
@@ -184,0 +182,0 @@ form = exports.form = (function () { |
{ | ||
"name": "commonform-validate", | ||
"description": "validate Common Forms", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (https://kemitchell.com)", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
@@ -569,2 +569,37 @@ Common Form represents legal forms, and pieces of legal forms, as | ||
) | ||
assert( | ||
validate.form( | ||
{ | ||
content: [ | ||
{ | ||
heading: 'Here Come Components!', | ||
form: { | ||
content: [ | ||
{ | ||
heading: 'Warranty Disclaimer', | ||
repository: 'api.commonform.org', | ||
publisher: 'kemitchell', | ||
project: 'orthodox-software-copyright-license', | ||
edition: '1e', | ||
upgrade: 'yes', | ||
substitutions: { | ||
terms: { | ||
'Licensor': 'Vendor', | ||
'Licensee': 'Customer', | ||
'Program': 'Software' | ||
}, | ||
headings: { | ||
'Express Warranties': 'Guarantees' | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}, | ||
{allowComponents: true} | ||
) | ||
) | ||
``` | ||
@@ -571,0 +606,0 @@ |
33875
808
231