commonform-predicate
Advanced tools
Comparing version 0.4.0 to 0.4.1
{ | ||
"name": "commonform-predicate", | ||
"description": "distinguish Common Form content objects", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"author": "Kyle E. Mitchell <kyle@kemitchell.com> (http://kemitchell.com)", | ||
"bugs": "https://github.com/commonform/commonform-predicate/issues", | ||
"dependencies": { | ||
@@ -11,11 +10,5 @@ "is-string": "^1.0.4" | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"check-versions": "^1.0.0", | ||
"commonform-validate": "^0.4.0", | ||
"istanbul": "^0.3.5", | ||
"jscs": "^1.10.0", | ||
"jshint": "^2.6.0", | ||
"mocha": "^2.1.0" | ||
"defence-cli": "~1.0.1", | ||
"replace-require-self": "~1.0.0" | ||
}, | ||
"homepage": "https://commonform.github.io", | ||
"keywords": [ | ||
@@ -29,12 +22,9 @@ "contracts", | ||
"license": "Apache-2.0", | ||
"main": "commonform-predicate.js", | ||
"peerDependencies": { | ||
"commonform": "1.x" | ||
}, | ||
"repository": "commonform/commonform-predicate", | ||
"scripts": { | ||
"check": "check-versions --check-module", | ||
"coverage": "istanbul cover _mocha && istanbul check-coverage coverage/coverage.json", | ||
"lint": "jshint commonform-predicate.js test && jscs commonform-predicate.js test", | ||
"pre-commit": "npm run lint && npm run check && npm run coverage", | ||
"test": "mocha", | ||
"travis-ci": "npm run pre-commit" | ||
"test": "defence README.md | replace-require-self | node" | ||
} | ||
} |
@@ -1,7 +0,32 @@ | ||
commonform-predicate | ||
==================== | ||
```javascript | ||
var predicate = require('commonform-predicate') | ||
``` | ||
[![NPM version](https://img.shields.io/npm/v/commonform-predicate.svg)](https://www.npmjs.com/package/commonform-predicate) | ||
[![build status](https://img.shields.io/travis/commonform/commonform-predicate.svg)](http://travis-ci.org/commonform/commonform-predicate) | ||
The exported functions can be used to find the type of a `content` array element in a known-valid form, to avoid doing all that's necessary to ensure validity. | ||
Distinguish Common Form content objects. | ||
If you a know a form object is valid, and need to pick out specific content elements, use `commonform-predicate`, not `commonform-validate`. | ||
```javascript | ||
var assert = require('assert') | ||
var invalid = { invalid: 'object' } | ||
var validForm = { content: [ 'Valid text' ] } | ||
assert(predicate.definition({ definition: 'Term' })) | ||
assert(!predicate.definition(invalid)) | ||
assert(predicate.use({ use: 'Term' })) | ||
assert(!predicate.use({ term: 'Term' })) | ||
assert(predicate.reference({ reference: 'Term' })) | ||
assert(!predicate.reference(invalid)) | ||
assert(predicate.blank({ blank: 'Value' })) | ||
assert(!predicate.blank(invalid)) | ||
assert(predicate.child({ heading: 'Summary', form: validForm })) | ||
assert(!predicate.child(invalid)) | ||
assert(predicate.text('Text')) | ||
assert(!predicate.text(null)) | ||
``` |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
2
33
1985
2
3
9
2
1