# commonform-predicate

> distinguish Common Form content objects

Latest version **7.0.1** (published 2026-09-05) · BlueOak-1.0.0 license · 0 weekly downloads

## Install

```sh
npm install commonform-predicate
pnpm add commonform-predicate
yarn add commonform-predicate
bun add commonform-predicate
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 7.0.1 |
| Published | 2026-09-05 |
| First published | 2015-02-18 |
| Weekly downloads | 0 |
| License | BlueOak-1.0.0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kyle E. Mitchell |
| Maintainers | kemitchell |
| Keywords | contracts, document assembly, knowledge management, law, predicates |

## Links

- npm: https://www.npmjs.com/package/commonform-predicate
- Repository: https://github.com/commonform/commonform-predicate
- Homepage: https://commonform.github.io
- Issues: https://github.com/commonform/commonform-predicate/issues
- npm.io page: https://npm.io/package/commonform-predicate

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 7.0.1 (latest) — 2026-09-05
- 7.0.0 — 2026-09-05
- 6.0.0 — 2023-09-14
- 5.0.0 — 2023-09-14
- 4.0.0 — 2022-06-05
- 3.0.1 — 2019-05-29
- 3.0.0 — 2019-05-29
- 2.0.0 — 2018-01-25
- 1.0.0 — 2016-08-21
- 0.4.4 — 2016-02-14
- 0.4.3 — 2015-09-07
- 0.4.2 — 2015-09-01
- 0.4.1 — 2015-09-01
- 0.4.0 — 2015-04-15
- 0.3.0 — 2015-03-08
- … 3 more at https://npm.io/package/commonform-predicate/versions

## README

```javascript
import * as predicate from "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.

If you a know a form object is valid, and need to pick out specific content elements, use `commonform-predicate`, not `commonform-validate`.

```javascript
import assert from "node:assert";

const invalid = { invalid: "object" };
const 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.link({ link: "https://example.com" }));
assert(predicate.link({ link: "http://example.com" }));
assert(!predicate.link(invalid));

assert(predicate.child({ heading: "Summary", form: validForm }));
assert(!predicate.child(invalid));

assert(
  predicate.component({
    heading: "Warranty Disclaimer",
    component: "https://commonform.org/kemitchell/orthodox-software-copyright-license",
    version: "1.0.0",
    substitutions: {
      terms: {
        Licensor: "Vendor",
        Licensee: "Customer",
        Program: "Software",
      },
      headings: {
        "Express Warranties": "Guarantees",
      },
    },
  }),
);

assert(predicate.text("Text"));
assert(!predicate.text(null));
```

---
_Source: https://npm.io/package/commonform-predicate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
