{
  "$schema": "../cases.schema.json",
  "format": 1,
  "domain": "certidao",
  "title": {
    "en": "Civil registry certificate",
    "pt-BR": "Certidão"
  },
  "functions": [
    {
      "id": "certidao.format",
      "level": "extended",
      "summary": "Formats the matrícula of a certidão de registro civil into the printed mask of the norm.",
      "description": "Formats the matrícula of a certidão de registro civil into the printed mask of art. 473 of the Código Nacional de Normas. The mask groups the 32 digits as 6 2 2 4 1 5 3 7 2, separated by spaces.\n\n- The function applies the mask as far as the digits go, so a partial matrícula being typed is masked progressively, and digits beyond the 32nd are dropped. `options.pad` left-pads with zeros to 32 digits first.\n- A full 32-digit matrícula does not fit an integer, so you must give it as a string.\n- A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string (2.4.0 read the digits of any number, sign and decimal point dropped).\n- A value with no digits returns an empty string even with `options.pad`. Until 2.4.0 it returned the full zero mask.\n- `options.pad` defaults to `false`.",
      "params": [
        {
          "name": "value",
          "type": "string | number"
        },
        {
          "name": "options",
          "type": "FormatCertidaoOptions",
          "optional": true
        }
      ],
      "returns": "string",
      "cases": [
        {
          "id": "certidao.format#[\"10453901552013100012021000012321\"]",
          "args": [
            "10453901552013100012021000012321"
          ],
          "expect": {
            "returns": "104539 01 55 2013 1 00012 021 0000123 21"
          }
        },
        {
          "id": "certidao.format#remasks",
          "args": [
            "104539.01.55.2013.1.00012.021.0000123-21"
          ],
          "expect": {
            "returns": "104539 01 55 2013 1 00012 021 0000123 21"
          }
        },
        {
          "id": "certidao.format#partial",
          "args": [
            "10453901"
          ],
          "expect": {
            "returns": "104539 01"
          }
        },
        {
          "id": "certidao.format#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": ""
          }
        },
        {
          "id": "certidao.format#[\"09430001552010100020112000012087\"]",
          "args": [
            "09430001552010100020112000012087"
          ],
          "expect": {
            "returns": "094300 01 55 2010 1 00020 112 0000120 87"
          },
          "note": "JavaScript's own test: should return the matrícula in the printed mask for 094300 01 55 2010 1 00020 112 0000120-87 (klawdyo/validation-br certidao.spec.ts)"
        },
        {
          "id": "certidao.format#[\"1045390155201310001202100001232199\"]",
          "args": [
            "1045390155201310001202100001232199"
          ],
          "expect": {
            "returns": "104539 01 55 2013 1 00012 021 0000123 21"
          },
          "note": "JavaScript's own test: should return a partial mask when the value has more than 32 digits, dropping the excess"
        },
        {
          "id": "certidao.format#[\"1552010100020112000012087\",{\"pad\":true}]",
          "args": [
            "1552010100020112000012087",
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": "000000 01 55 2010 1 00020 112 0000120 87"
          },
          "note": "JavaScript's own test: should left pad the value when options.pad is true"
        },
        {
          "id": "certidao.format#[104539015520]",
          "args": [
            104539015520
          ],
          "expect": {
            "returns": "104539 01 55 20"
          },
          "note": "JavaScript's own test: should read a number as the string of its digits, like formatCpf masking it as far as it goes; a full 32 digit matrícula still has to be a string"
        },
        {
          "id": "certidao.format#[1045390155.2]",
          "args": [
            1045390155.2
          ],
          "expect": {
            "returns": ""
          },
          "note": "JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number (#593 number rule)"
        },
        {
          "id": "certidao.format#[-1]",
          "args": [
            -1
          ],
          "expect": {
            "returns": ""
          },
          "note": "JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number (#593 number rule)"
        },
        {
          "id": "certidao.format#[9007199254740992]",
          "args": [
            9007199254740992
          ],
          "expect": {
            "returns": ""
          },
          "note": "JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number (#593 number rule)"
        },
        {
          "id": "certidao.format#[\"\",{\"pad\":true}]",
          "args": [
            "",
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": ""
          },
          "note": "changed in 2.5.0 (#615): a value with no digits returns an empty string even with pad; JavaScript docs: an empty value gives '' even with pad"
        },
        {
          "id": "certidao.format#[\"abc\",{\"pad\":true}]",
          "args": [
            "abc",
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": ""
          },
          "note": "changed in 2.5.0 (#615): no digits, even with pad"
        }
      ]
    },
    {
      "id": "certidao.getInfo",
      "level": "extended",
      "summary": "Splits the matrícula of a certidão de registro civil into its fields.",
      "description": "Parses the matrícula of a certidão de registro civil into its fields. Returns `null` when it is not valid (same rules as `certidao.isValid`).\n\n- `type` is the English name of the book (`birth`, `marriage`, `religious-marriage`, `death`, `stillbirth`, `banns`, `other`, `emancipation`, `interdiction`). Fields: CNS of the serventia (6 digits), acervo, service (always `55`), year, book type (birth, marriage, religious marriage, death, stillbirth, banns, other, emancipation, interdiction) and its raw code 1 to 9, book, page, term and the 2 check digits.\n- `year` and `typeCode` are numbers. `registryCns`, `acervo`, `service`, `book`, `page`, `term` and `checkDigits` are strings that keep their leading zeros. The input is read like `certidao.isValid` reads it, so a masked value works and a non-string returns `null`.\n- Art. 473 V of the Código Nacional de Normas lists book codes 1 to 7. Codes 8 (emancipação) and 9 (interdição) come from Provimento CNJ 3/2009, art. 7º V. That provimento was revoked by Provimento CNJ 63/2017, but certidões issued under it from 2010 carry those codes and are still valid, so both are read, as in 2.4.0.\n- `acervo` is `01` for the serventia's own acervo and `02` and up for each acervo it absorbed. Art. 473, §§ 3º to 5º split the absorbed ones by the date the origin serventia was extinguished or deactivated. Up to 31/12/2009 the CNS is the incorporating unit's and the acervo code runs from `02`, one per incorporation. From 01/01/2010 the CNS is the incorporated unit's own and the code is `01`, counted as that unit's own acervo. An acervo split between two or more successor serventias gets each successor's CNS with the code `02`.",
      "params": [
        {
          "name": "value",
          "type": "string"
        }
      ],
      "returns": "CertidaoInfo?",
      "cases": [
        {
          "id": "certidao.getInfo#[\"104539 01 55 2013 1 00012 021 0000123 21\"]",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21"
          ],
          "expect": {
            "returns": {
              "registryCns": "104539",
              "acervo": "01",
              "service": "55",
              "year": 2013,
              "type": "birth",
              "typeCode": 1,
              "book": "00012",
              "page": "021",
              "term": "0000123",
              "checkDigits": "21"
            }
          }
        },
        {
          "id": "certidao.getInfo#[\"094300 01 55 2010 1 00020 112 0000120-87\"]",
          "args": [
            "094300 01 55 2010 1 00020 112 0000120-87"
          ],
          "expect": {
            "returns": {
              "registryCns": "094300",
              "acervo": "01",
              "service": "55",
              "year": 2010,
              "type": "birth",
              "typeCode": 1,
              "book": "00020",
              "page": "112",
              "term": "0000120",
              "checkDigits": "87"
            }
          }
        },
        {
          "id": "certidao.getInfo#wrong-check-digits",
          "args": [
            "10453901552013100012021000012322"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "certidao.getInfo#[\"not-a-matricula\"]",
          "args": [
            "not-a-matricula"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "certidao.getInfo#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "certidao.getInfo#[\"10453901552013000012021000012387\"]",
          "args": [
            "10453901552013000012021000012387"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null when the book code is 0, outside the nine books of the Provimento"
        },
        {
          "id": "certidao.getInfo#[\"09400301542011100110002005191744\"]",
          "args": [
            "09400301542011100110002005191744"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null when the serviço is not the 55 of art. 473, III, even with matching check digits"
        },
        {
          "id": "certidao.getInfo#[\"82668301552015209245842999011418\"]",
          "args": [
            "82668301552015209245842999011418"
          ],
          "expect": {
            "returns": {
              "registryCns": "826683",
              "acervo": "01",
              "service": "55",
              "year": 2015,
              "type": "marriage",
              "typeCode": 2,
              "book": "09245",
              "page": "842",
              "term": "9990114",
              "checkDigits": "18"
            }
          },
          "note": "JavaScript's own test: should return the parsed matrícula for a matrícula whose first modulus 11 remainder is 10 (826683 01 55 2015 2 09245 842 9990114 18)"
        },
        {
          "id": "certidao.getInfo#[\"10453901552013800012021000012343\"]",
          "args": [
            "10453901552013800012021000012343"
          ],
          "expect": {
            "returns": {
              "registryCns": "104539",
              "acervo": "01",
              "service": "55",
              "year": 2013,
              "type": "emancipation",
              "typeCode": 8,
              "book": "00012",
              "page": "021",
              "term": "0000123",
              "checkDigits": "43"
            }
          },
          "note": "JavaScript's own test: should return the fields for an emancipation act, book code 8 of the revoked Provimento CNJ nº 3/2009"
        },
        {
          "id": "certidao.getInfo#[\"10453901552013900012021000012398\"]",
          "args": [
            "10453901552013900012021000012398"
          ],
          "expect": {
            "returns": {
              "registryCns": "104539",
              "acervo": "01",
              "service": "55",
              "year": 2013,
              "type": "interdiction",
              "typeCode": 9,
              "book": "00012",
              "page": "021",
              "term": "0000123",
              "checkDigits": "98"
            }
          },
          "note": "JavaScript's own test: should return the fields for an interdiction act, book code 9 of the revoked Provimento CNJ nº 3/2009"
        }
      ]
    },
    {
      "id": "certidao.isValid",
      "level": "extended",
      "summary": "Validates the matrícula of a certidão de registro civil (nascimento, casamento, óbito and the other acts kept by a serventia de registro civil das pessoas naturais).",
      "description": "Validates the 32-digit matrícula of a certidão de registro civil (art. 473 of the Código Nacional de Normas da Corregedoria Nacional de Justiça).\n\n- Layout: CNS da serventia (6), acervo (2), serviço (2, always `55`), ano (4), tipo do livro (1), livro (5), folha (3), termo (7) and 2 modulus 11 check digits.\n- The serviço must be `55`. The book type must be 1 to 7 (the books of art. 473 V) or 8 (`emancipation`, Livro E split for emancipações) or 9 (`interdiction`, Livro E split for interdições), which come from the revoked Provimento CNJ 3/2009, art. 7º V, and are kept because certidões issued under it from 2010 still carry them. The function rejects `0`, whatever the check digits.\n- `options.accept` limits the valid book types to the listed ones (default: every type).\n- Accepts the value unmasked or masked. Between the nine groups (6 2 2 4 1 5 3 7 2) any run of whitespace, `.`, `-` or `/` is allowed, and whitespace around the value is ignored; another separator (`#`), a letter, or digits grouped differently make the value invalid.\n- No official source publishes the check-digit algorithm. Art. 473 IX only names the check digits (positions 31 and 32). Provimento CNJ 3/2009 had them generated by a program the CNJ gave to the registrars, and the Caixa's Cadastro NIS layout says only \"módulo 11\". The modulus 11 weights and remainder rule (a remainder of 10 is read as 1) follow community reference implementations.\n- Only a string is accepted. The 32 digits of a matrícula do not fit a number.\n- `options.accept` is a list of book types (`birth`, `marriage`, `religious-marriage`, `death`, `stillbirth`, `banns`, `other`, `emancipation`, `interdiction`). When it is missing or not a list, every type is accepted. An empty list accepts none, so the result is `false`.",
      "params": [
        {
          "name": "value",
          "type": "string"
        },
        {
          "name": "options",
          "type": "IsValidCertidaoOptions",
          "optional": true
        }
      ],
      "returns": "boolean",
      "cases": [
        {
          "id": "certidao.isValid#[\"10453901552013100012021000012321\"]",
          "args": [
            "10453901552013100012021000012321"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "certidao.isValid#masked",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "certidao.isValid#[\"094003 01 55 2011 1 00110 002 0051917 43\"]",
          "args": [
            "094003 01 55 2011 1 00110 002 0051917 43"
          ],
          "expect": {
            "returns": true
          }
        },
        {
          "id": "certidao.isValid#wrong-check-digits",
          "args": [
            "10453901552013100012021000012322"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "certidao.isValid#too-short",
          "args": [
            "104539015520131000120210000123"
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "certidao.isValid#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": false
          }
        },
        {
          "id": "certidao.isValid#[\"104539015520131000120210000123210\"]",
          "args": [
            "104539015520131000120210000123210"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when it does not have 32 digits"
        },
        {
          "id": "certidao.isValid#[\"104539#01#55#2013#1#00012#021#0000123#21\"]",
          "args": [
            "104539#01#55#2013#1#00012#021#0000123#21"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when it has 32 digits but an unsupported separator"
        },
        {
          "id": "certidao.isValid#[\"1045.3901.5520.1310.0012.0210.0001.2321\"]",
          "args": [
            "1045.3901.5520.1310.0012.0210.0001.2321"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when it has 32 digits grouped outside the 6-2-2-4-1-5-3-7-2 mask"
        },
        {
          "id": "certidao.isValid#[\"A04539 01 55 2013 1 00012 021 0000123 21\"]",
          "args": [
            "A04539 01 55 2013 1 00012 021 0000123 21"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when it contains letters"
        },
        {
          "id": "certidao.isValid#[\"10453901552013100012021000012320\"]",
          "args": [
            "10453901552013100012021000012320"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when only the second check digit is wrong (the ghiorzi.org example with 20)"
        },
        {
          "id": "certidao.isValid#[\"12345601552023100001001000000199\"]",
          "args": [
            "12345601552023100001001000000199"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when the check digits are 99 (klawdyo/validation-br certidao.spec.ts invalid case)"
        },
        {
          "id": "certidao.isValid#[\"10453901552013000012021000012387\"]",
          "args": [
            "10453901552013000012021000012387"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when the book code is 0, outside the nine books, even with matching check digits"
        },
        {
          "id": "certidao.isValid#[\"09400301542011100110002005191744\"]",
          "args": [
            "09400301542011100110002005191744"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when the serviço is not the 55 of art. 473, III, even with matching check digits"
        },
        {
          "id": "certidao.isValid#[\"094003 01 56 2011 1 00110 002 0051917 42\"]",
          "args": [
            "094003 01 56 2011 1 00110 002 0051917 42"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when the serviço is not the 55 of art. 473, III, even with matching check digits"
        },
        {
          "id": "certidao.isValid#[\"131128 01 55 2010 1 00014 192 0006001 00\"]",
          "args": [
            "131128 01 55 2010 1 00014 192 0006001 00"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for 131128 01 55 2010 1 00014 192 0006001 00 (klawdyo/validation-br certidao.spec.ts)"
        },
        {
          "id": "certidao.isValid#[\"094003 01 55 2010 1 00109 151 0051816 26\"]",
          "args": [
            "094003 01 55 2010 1 00109 151 0051816 26"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for 094003 01 55 2010 1 00109 151 0051816 26 (klawdyo/validation-br certidao.spec.ts)"
        },
        {
          "id": "certidao.isValid#[\"094300 01 55 2010 1 00020 112 0000120-87\"]",
          "args": [
            "094300 01 55 2010 1 00020 112 0000120-87"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for 094300 01 55 2010 1 00020 112 0000120-87 with a dash before the check digits (klawdyo/validation-br certidao.spec.ts)"
        },
        {
          "id": "certidao.isValid#[\"094946 01 55 2011 1 00241 196 0099147 54\"]",
          "args": [
            "094946 01 55 2011 1 00241 196 0099147 54"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for 094946 01 55 2011 1 00241 196 0099147 54 (klawdyo/validation-br certidao.spec.ts)"
        },
        {
          "id": "certidao.isValid#[\"001234 01 55 2026 1 00567 078 0099999 92\"]",
          "args": [
            "001234 01 55 2026 1 00567 078 0099999 92"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for 001234 01 55 2026 1 00567 078 0099999 92 (klawdyo/validation-br certidao.spec.ts)"
        },
        {
          "id": "certidao.isValid#[\"82668301552015209245842999011418\"]",
          "args": [
            "82668301552015209245842999011418"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for a matrícula whose first modulus 11 remainder is 10 and is read as 1"
        },
        {
          "id": "certidao.isValid#[\"79975401552015772710866666109571\"]",
          "args": [
            "79975401552015772710866666109571"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for a matrícula whose second modulus 11 remainder is 10 and is read as 1"
        },
        {
          "id": "certidao.isValid#[\"104539.01.55.2013.1.00012.021.0000123-21\"]",
          "args": [
            "104539.01.55.2013.1.00012.021.0000123-21"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the dotted mask of the Provimento"
        },
        {
          "id": "certidao.isValid#[\" 104539 01 55 2013 1 00012 021 0000123 21 \"]",
          "args": [
            " 104539 01 55 2013 1 00012 021 0000123 21 "
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the ghiorzi.org example with leading and trailing whitespace"
        },
        {
          "id": "certidao.isValid#[\"104539 01 55 2013 1 00012 021 0000123 21\",{\"accept\":[\"birth\"]}]",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21",
            {
              "accept": [
                "birth"
              ]
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: options.accept should return true when the book type is in the accepted list"
        },
        {
          "id": "certidao.isValid#[\"104539 01 55 2013 1 00012 021 0000123 21\",{\"accept\":[\"death\",\"birth\"]}]",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21",
            {
              "accept": [
                "death",
                "birth"
              ]
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: options.accept should return true when the book type is one of several accepted types"
        },
        {
          "id": "certidao.isValid#[\"104539 01 55 2013 1 00012 021 0000123 21\",{\"accept\":[\"death\"]}]",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21",
            {
              "accept": [
                "death"
              ]
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: options.accept should return false when the book type is not in the accepted list"
        },
        {
          "id": "certidao.isValid#[\"104539 01 55 2013 1 00012 021 0000123 21\",{\"accept\":[]}]",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21",
            {
              "accept": []
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: options.accept should return false when the accepted list is empty"
        },
        {
          "id": "certidao.isValid#[\"10453901552013900012021000012398\",{\"accept\":[\"interdiction\"]}]",
          "args": [
            "10453901552013900012021000012398",
            {
              "accept": [
                "interdiction"
              ]
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: options.accept should return true for an interdiction act (book code 9) when accepted"
        },
        {
          "id": "certidao.isValid#[\"10453901552013000012021000012387\",{\"accept\":[\"birth\"]}]",
          "args": [
            "10453901552013000012021000012387",
            {
              "accept": [
                "birth"
              ]
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: options.accept should return false when the book code is 0, outside the nine books of the Provimento, and accept is given"
        },
        {
          "id": "certidao.isValid#[\"123456\",{\"accept\":[\"birth\"]}]",
          "args": [
            "123456",
            {
              "accept": [
                "birth"
              ]
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: options.accept should return false when the matrícula itself is invalid, regardless of accept"
        },
        {
          "id": "certidao.isValid#[\"10453901552013700012021000012315\"]",
          "args": [
            "10453901552013700012021000012315"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for the book codes 7, 8 and 9: art. 473, V, and the revoked Provimento CNJ nº 3/2009, art. 7º, V"
        },
        {
          "id": "certidao.isValid#[\"10453901552013800012021000012343\"]",
          "args": [
            "10453901552013800012021000012343"
          ],
          "expect": {
            "returns": true
          },
          "note": "from the maintainer briefing, #593 (book codes 8 and 9 back to the 2.4.0 behaviour). JavaScript's own test: should return true for the book codes 7, 8 and 9: art. 473, V, and the revoked Provimento CNJ nº 3/2009, art. 7º, V"
        },
        {
          "id": "certidao.isValid#[\"10453901552013900012021000012398\"]",
          "args": [
            "10453901552013900012021000012398"
          ],
          "expect": {
            "returns": true
          },
          "note": "from the maintainer briefing, #593 (book codes 8 and 9 back to the 2.4.0 behaviour). JavaScript's own test: should return true for the book codes 7, 8 and 9: art. 473, V, and the revoked Provimento CNJ nº 3/2009, art. 7º, V"
        },
        {
          "id": "certidao.isValid#[\"10453901552013800012021000012343\",{\"accept\":[\"emancipation\"]}]",
          "args": [
            "10453901552013800012021000012343",
            {
              "accept": [
                "emancipation"
              ]
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: options.accept should accept the book codes 8 and 9 of the Provimento CNJ nº 3/2009 when their types are accepted"
        },
        {
          "id": "certidao.isValid#[\"10453901552013800012021000012343\",{\"accept\":[\"other\"]}]",
          "args": [
            "10453901552013800012021000012343",
            {
              "accept": [
                "other"
              ]
            }
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: options.accept should accept the book codes 8 and 9 of the Provimento CNJ nº 3/2009 when their types are accepted"
        },
        {
          "id": "certidao.isValid#[\"104539 01 55 2013 1 00012 021 0000123 21\",{\"accept\":\"birth\"}]",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21",
            {
              "accept": "birth"
            }
          ],
          "expect": {
            "returns": true
          },
          "note": "an accept that is not a list is ignored"
        }
      ]
    },
    {
      "id": "certidao.parse",
      "level": "extended",
      "summary": "Removes the formatting characters of the matrícula of a certidão de registro civil and returns only the digits.",
      "description": "Removes the formatting of a certidão matrícula and keeps only digits, capped at 32 digits.\n\n- A value shorter than 32 digits passes through as far as it goes, so the mask of an input still being typed can be stripped. Nothing is padded.\n- A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number returns an empty string (2.4.0 read the digits of any number, sign and decimal point dropped).",
      "params": [
        {
          "name": "value",
          "type": "string | number"
        }
      ],
      "returns": "string",
      "cases": [
        {
          "id": "certidao.parse#masked",
          "args": [
            "104539 01 55 2013 1 00012 021 0000123 21"
          ],
          "expect": {
            "returns": "10453901552013100012021000012321"
          }
        },
        {
          "id": "certidao.parse#strips-non-digits",
          "args": [
            "104539.01.55.2013.1.00012.021.0000123-21abc"
          ],
          "expect": {
            "returns": "10453901552013100012021000012321"
          }
        },
        {
          "id": "certidao.parse#caps-length",
          "args": [
            "10453901552013100012021000012321999"
          ],
          "expect": {
            "returns": "10453901552013100012021000012321"
          },
          "note": "reference truncates to 32 digits; asserted by the reference (JS) unit tests"
        },
        {
          "id": "certidao.parse#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": ""
          }
        },
        {
          "id": "certidao.parse#[\"104539 01\"]",
          "args": [
            "104539 01"
          ],
          "expect": {
            "returns": "10453901"
          },
          "note": "JavaScript's own test: should keep a partial matrícula as written"
        },
        {
          "id": "certidao.parse#[-1]",
          "args": [
            -1
          ],
          "expect": {
            "returns": ""
          },
          "note": "JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number (#593 number rule)"
        },
        {
          "id": "certidao.parse#[1.5]",
          "args": [
            1.5
          ],
          "expect": {
            "returns": ""
          },
          "note": "JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number (#593 number rule)"
        },
        {
          "id": "certidao.parse#[9007199254740992]",
          "args": [
            9007199254740992
          ],
          "expect": {
            "returns": ""
          },
          "note": "JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number (#593 number rule)"
        }
      ]
    }
  ]
}
