Legal citation extractor. Standalone library, and optional HTTP API.
npm install citation
A fast, stand-alone legal citation extractor.
Currently supports:
* usc: US Code
* law: US Slip Laws (public and private laws)
* stat: US Statutes at Large
* cfr: US Code of Federal Regulations
* dc_code: DC Code
* dc_register: DC Register
* dc_law: DC Slip Law
With limited, opt-in support for:
* judicial: US court opinions, using walverine (more below)
As you can see, Citation is currently US-only, but we'd love for that to change. There are lots more citation types out there, and it's easy to contribute, so please help us grow!
Compatible in-browser with modern browsers, including IE 9+.
Citation can be used:
1. In JavaScript, in browser or in Node. This method supports the most options, including passing in JavaScript functions as callbacks.
2. Over HTTP, via GET or POST. Supports JSON and JSONP. Options require function callbacks are not supported (it won't eval JavaScript).
3. On the command line or Unix pipes, over STDOUT. Options require function callbacks are not supported (it won't eval JavaScript).
But one way or another, you pass in text:
``javascript`
Citation.find("pursuant to 5 U.S.C. 552(a)(1)(E) and");
And you get back data about matched citations:
`javascript`
[{
"match": "5 U.S.C. 552(a)(1)(E)",
"citation": "5 U.S.C. 552(a)(1)(E)",
"type": "usc",
"index": "0",
"usc": {
"title": "5",
"section": "552",
"subsections": ["a", "1", "E"],
"id": "usc/5/552/a/1/E",
"section_id": "usc/5/552"
}
}]
Check out /browser for browser-ready compressed and uncompressed versions of the library.
Loading any of them with a