Skip to content

Latest commit

 

History

History
42 lines (30 loc) · 1.59 KB

README.md

File metadata and controls

42 lines (30 loc) · 1.59 KB

validate-cnj

npm version build status coverage status dependency status devDependency status Gitter

Validador da numeração CNJ escrito em JavaScript com suporte para navegadores, pegar e usar.

Installation

npm install validate-cnj --save

TL-DR

import { Validate } from 'validate-cnj'

Validate.load("1500345-34.2017.8.26.0248")
// Thrown: ValidateCNJException: Checksum not correct - CNJ number is invalid. Expected is 31, received 34.

Validate.load("1500345-31.2017.8.26.0248")
// ValidateCNJ {
//   dv: '31',
//   proc: '1500345',
//   year: '2017',
//   justice: '8',
//   number: '26',
//   court: '0248'
// }

Validate.load("1500345-31.2017.8260248").generate(true)
// '1500345-31.2017.8.26.0248'

Validate.load("1500345-31.2017.8260248").generate(false)
// '15003453120178260248'

Validate.factory("1500345", {justice:8, court: 248, number: 26}, 2020).generate(true)
// '1500345-26.2020.8.26.0248'

License

MIT