New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

commonform-predicate

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

commonform-predicate - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

index.js

24

package.json
{
"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))
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc