commonform-predicate
Advanced tools
Comparing version 3.0.0 to 3.0.1
24
index.js
@@ -1,18 +0,10 @@ | ||
var has = function (key) { | ||
return function (argument) { | ||
return argument.hasOwnProperty(key) | ||
} | ||
} | ||
var types = [ 'blank', 'definition', 'reference', 'use' ] | ||
types.forEach(function (type) { | ||
exports[type] = has(type) | ||
[ 'blank', 'definition', 'reference', 'use' ].forEach(function (type) { | ||
exports[type] = hasProperty(type) | ||
}) | ||
exports.child = has('form') | ||
exports.child = hasProperty('form') | ||
exports.component = has('repository') | ||
exports.component = hasProperty('repository') | ||
exports.form = has('content') | ||
exports.form = hasProperty('content') | ||
@@ -22,1 +14,7 @@ exports.text = function (argument) { | ||
} | ||
function hasProperty (key) { | ||
return function (argument) { | ||
return argument.hasOwnProperty(key) | ||
} | ||
} |
{ | ||
"name": "commonform-predicate", | ||
"description": "distinguish Common Form content objects", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (http://kemitchell.com)", | ||
@@ -6,0 +6,0 @@ "devDependencies": { |
@@ -12,18 +12,18 @@ ```javascript | ||
var invalid = {invalid: 'object'} | ||
var validForm = {content: ['Valid text']} | ||
var invalid = { invalid: 'object' } | ||
var validForm = { content: [ 'Valid text' ] } | ||
assert(predicate.definition({definition: 'Term'})) | ||
assert(predicate.definition({ definition: 'Term' })) | ||
assert(!predicate.definition(invalid)) | ||
assert(predicate.use({use: 'Term'})) | ||
assert(!predicate.use({term: 'Term'})) | ||
assert(predicate.use({ use: 'Term' })) | ||
assert(!predicate.use({ term: 'Term' })) | ||
assert(predicate.reference({reference: 'Term'})) | ||
assert(predicate.reference({ reference: 'Term' })) | ||
assert(!predicate.reference(invalid)) | ||
assert(predicate.blank({blank: 'Value'})) | ||
assert(predicate.blank({ blank: 'Value' })) | ||
assert(!predicate.blank(invalid)) | ||
assert(predicate.child({heading: 'Summary', form: validForm})) | ||
assert(predicate.child({ heading: 'Summary', form: validForm })) | ||
assert(!predicate.child(invalid)) | ||
@@ -30,0 +30,0 @@ |
4200
14