{
  "$schema": "../cases.schema.json",
  "format": 1,
  "domain": "boleto",
  "title": {
    "en": "Boleto",
    "pt-BR": "Boleto"
  },
  "functions": [
    {
      "id": "boleto.format",
      "level": "extended",
      "summary": "Formats a value as a Brazilian boleto.",
      "description": "Formats a boleto linha digitável with its printed mask.\n\n- The function groups the 47-digit cobrança bancária linha digitável as `00000.00000 00000.000000 00000.000000 0 00000000000000`.\n- A 48-digit linha digitável starting with `8` (boleto de arrecadação) gets four blocks of 11 digits, each followed by its check digit. The 44-digit arrecadação barcode keeps the cobrança bancária mask, and a 44-digit value starting with `8` is always read as an arrecadação barcode.\n- Every character that is not a digit is removed first, so a masked value is accepted. Digits beyond the length of the pattern are dropped.\n- Without `options.pad` a short value is masked only as far as its digits go (`104914` gives `10491.4`).\n- A value with no digits (an empty string, `abc`, `null`) gives an empty string, even with `options.pad`. Until 2.4.0 `pad: true` returned the full zero mask for an empty string or one without digits.\n- `options.pad` left-pads the value with zeros to the length of the pattern before masking.\n- A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number gives an empty string (2.4.0 read the digits of any number).",
      "params": [
        {
          "name": "value",
          "type": "string | number"
        },
        {
          "name": "options",
          "type": "FormatBoletoOptions",
          "optional": true
        }
      ],
      "returns": "string",
      "cases": [
        {
          "id": "boleto.format#full",
          "args": [
            "10491443385511900000200000000141325230000093423"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 25230000093423"
          }
        },
        {
          "id": "boleto.format#partial",
          "args": [
            "104914"
          ],
          "expect": {
            "returns": "10491.4"
          }
        },
        {
          "id": "boleto.format#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": ""
          }
        },
        {
          "id": "boleto.format#[\"1\"]",
          "args": [
            "1"
          ],
          "expect": {
            "returns": "1"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10\"]",
          "args": [
            "10"
          ],
          "expect": {
            "returns": "10"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104\"]",
          "args": [
            "104"
          ],
          "expect": {
            "returns": "104"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049\"]",
          "args": [
            "1049"
          ],
          "expect": {
            "returns": "1049"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491\"]",
          "args": [
            "10491"
          ],
          "expect": {
            "returns": "10491"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144\"]",
          "args": [
            "1049144"
          ],
          "expect": {
            "returns": "10491.44"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443\"]",
          "args": [
            "10491443"
          ],
          "expect": {
            "returns": "10491.443"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433\"]",
          "args": [
            "104914433"
          ],
          "expect": {
            "returns": "10491.4433"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338\"]",
          "args": [
            "1049144338"
          ],
          "expect": {
            "returns": "10491.44338"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385\"]",
          "args": [
            "10491443385"
          ],
          "expect": {
            "returns": "10491.44338 5"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855\"]",
          "args": [
            "104914433855"
          ],
          "expect": {
            "returns": "10491.44338 55"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551\"]",
          "args": [
            "1049144338551"
          ],
          "expect": {
            "returns": "10491.44338 551"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511\"]",
          "args": [
            "10491443385511"
          ],
          "expect": {
            "returns": "10491.44338 5511"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119\"]",
          "args": [
            "104914433855119"
          ],
          "expect": {
            "returns": "10491.44338 55119"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190\"]",
          "args": [
            "1049144338551190"
          ],
          "expect": {
            "returns": "10491.44338 55119.0"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900\"]",
          "args": [
            "10491443385511900"
          ],
          "expect": {
            "returns": "10491.44338 55119.00"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000\"]",
          "args": [
            "104914433855119000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000\"]",
          "args": [
            "1049144338551190000"
          ],
          "expect": {
            "returns": "10491.44338 55119.0000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000\"]",
          "args": [
            "10491443385511900000"
          ],
          "expect": {
            "returns": "10491.44338 55119.00000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002\"]",
          "args": [
            "104914433855119000002"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020\"]",
          "args": [
            "1049144338551190000020"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 0"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200\"]",
          "args": [
            "10491443385511900000200"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000\"]",
          "args": [
            "104914433855119000002000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000\"]",
          "args": [
            "1049144338551190000020000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 0000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000\"]",
          "args": [
            "10491443385511900000200000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000000\"]",
          "args": [
            "104914433855119000002000000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.0"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000000\"]",
          "args": [
            "1049144338551190000020000000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.00"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000000\"]",
          "args": [
            "10491443385511900000200000000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000000001\"]",
          "args": [
            "104914433855119000002000000001"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.0001"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000000014\"]",
          "args": [
            "1049144338551190000020000000014"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.00014"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000000141\"]",
          "args": [
            "10491443385511900000200000000141"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000000001413\"]",
          "args": [
            "104914433855119000002000000001413"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000000014132\"]",
          "args": [
            "1049144338551190000020000000014132"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 2"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000000141325\"]",
          "args": [
            "10491443385511900000200000000141325"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 25"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000000001413252\"]",
          "args": [
            "104914433855119000002000000001413252"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 252"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000000014132523\"]",
          "args": [
            "1049144338551190000020000000014132523"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 2523"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000000141325230\"]",
          "args": [
            "10491443385511900000200000000141325230"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 25230"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000000001413252300\"]",
          "args": [
            "104914433855119000002000000001413252300"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 252300"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000000014132523000\"]",
          "args": [
            "1049144338551190000020000000014132523000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 2523000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000000141325230000\"]",
          "args": [
            "10491443385511900000200000000141325230000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 25230000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000000001413252300000\"]",
          "args": [
            "104914433855119000002000000001413252300000"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 252300000"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000000014132523000009\"]",
          "args": [
            "1049144338551190000020000000014132523000009"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 2523000009"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000000141325230000093\"]",
          "args": [
            "10491443385511900000200000000141325230000093"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 25230000093"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"104914433855119000002000000001413252300000934\"]",
          "args": [
            "104914433855119000002000000001413252300000934"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 252300000934"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"1049144338551190000020000000014132523000009342\"]",
          "args": [
            "1049144338551190000020000000014132523000009342"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 2523000009342"
          },
          "note": "JavaScript's own test: should format boleto with mask"
        },
        {
          "id": "boleto.format#[\"10491443385511900000200000000141325230000093423123123123\"]",
          "args": [
            "10491443385511900000200000000141325230000093423123123123"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 25230000093423"
          },
          "note": "JavaScript's own test"
        },
        {
          "id": "boleto.format#[\"10491.44A338 55119.000002? ABC00000.000?141 3 25230000093423\"]",
          "args": [
            "10491.44A338 55119.000002? ABC00000.000?141 3 25230000093423"
          ],
          "expect": {
            "returns": "10491.44338 55119.000002 00000.000141 3 25230000093423"
          },
          "note": "JavaScript's own test: should remove all non numeric characters boleto"
        },
        {
          "id": "boleto.format#[\"846100000005246100291102005460339004695895061080\"]",
          "args": [
            "846100000005246100291102005460339004695895061080"
          ],
          "expect": {
            "returns": "84610000000-5 24610029110-2 00546033900-4 69589506108-0"
          },
          "note": "JavaScript's own test: arrecadação should use the arrecadação mask when it starts with 8"
        },
        {
          "id": "boleto.format#[\"858900004609524601791605607593050865831483000010\"]",
          "args": [
            "858900004609524601791605607593050865831483000010"
          ],
          "expect": {
            "returns": "85890000460-9 52460179160-5 60759305086-5 83148300001-0"
          },
          "note": "JavaScript's own test: arrecadação should use the arrecadação mask when it starts with 8"
        },
        {
          "id": "boleto.format#[\"8\"]",
          "args": [
            "8"
          ],
          "expect": {
            "returns": "8"
          },
          "note": "JavaScript's own test: arrecadação should keep the cobrança bancária mask for partial values"
        },
        {
          "id": "boleto.format#[\"84610000000\"]",
          "args": [
            "84610000000"
          ],
          "expect": {
            "returns": "84610.00000 0"
          },
          "note": "JavaScript's own test: arrecadação should keep the cobrança bancária mask for partial values"
        },
        {
          "id": "boleto.format#[\"846100000005\"]",
          "args": [
            "846100000005"
          ],
          "expect": {
            "returns": "84610.00000 05"
          },
          "note": "JavaScript's own test: arrecadação should keep the cobrança bancária mask for partial values"
        },
        {
          "id": "boleto.format#[\"8461000000052\"]",
          "args": [
            "8461000000052"
          ],
          "expect": {
            "returns": "84610.00000 052"
          },
          "note": "JavaScript's own test: arrecadação should keep the cobrança bancária mask for partial values"
        },
        {
          "id": "boleto.format#[\"84610000000246100291100054603390069589506108\"]",
          "args": [
            "84610000000246100291100054603390069589506108"
          ],
          "expect": {
            "returns": "84610.00000 02461.002911 00054.603390 0 69589506108"
          },
          "note": "JavaScript's own test: arrecadação should keep the cobrança bancária mask for the 44 digit barcode"
        },
        {
          "id": "boleto.format#[\"846100000005246100291102005460339004695895061080123\"]",
          "args": [
            "846100000005246100291102005460339004695895061080123"
          ],
          "expect": {
            "returns": "84610.00000 05246.100291 10200.546033 9 00469589506108"
          },
          "note": "JavaScript's own test: arrecadação"
        },
        {
          "id": "boleto.format#[\"84610000000-5 24610029110-2 00546033900-4 69589506108-0\"]",
          "args": [
            "84610000000-5 24610029110-2 00546033900-4 69589506108-0"
          ],
          "expect": {
            "returns": "84610000000-5 24610029110-2 00546033900-4 69589506108-0"
          },
          "note": "JavaScript's own test: arrecadação should remove all non numeric characters"
        },
        {
          "id": "boleto.format#[-1]",
          "args": [
            -1
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule. JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        },
        {
          "id": "boleto.format#[1.5]",
          "args": [
            1.5
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule. JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        },
        {
          "id": "boleto.format#[9007199254740992]",
          "args": [
            9007199254740992
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule (2 ** 53 is not a safe integer). JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        },
        {
          "id": "boleto.format#[1e+21,{\"pad\":true}]",
          "args": [
            1e+21,
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule (even with pad). JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        },
        {
          "id": "boleto.format#[123]",
          "args": [
            123
          ],
          "expect": {
            "returns": "123"
          },
          "note": "a safe non-negative integer is read as its digits"
        },
        {
          "id": "boleto.format#[\"\",{\"pad\":true}]",
          "args": [
            "",
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": ""
          },
          "note": "should return an empty string for an empty value or one without digits"
        },
        {
          "id": "boleto.format#[\"abc\",{\"pad\":true}]",
          "args": [
            "abc",
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": ""
          },
          "note": "should return an empty string for an empty value or one without digits"
        },
        {
          "id": "boleto.format#[null,{\"pad\":true}]",
          "args": [
            null,
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": ""
          },
          "note": "should return an empty string instead of a zero-filled document"
        },
        {
          "id": "boleto.format#[\"1900000901149\",{\"pad\":true}]",
          "args": [
            "1900000901149",
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": "00000.00000 00000.000000 00000.000000 0 01900000901149"
          },
          "note": "JavaScript docs example"
        },
        {
          "id": "boleto.format#[123456,{\"pad\":true}]",
          "args": [
            123456,
            {
              "pad": true
            }
          ],
          "expect": {
            "returns": "00000.00000 00000.000000 00000.000000 0 00000000123456"
          },
          "note": "should pad a short value up to the bank slip length"
        },
        {
          "id": "boleto.format#[\"00190000090114971860168524522114675860000102656\"]",
          "args": [
            "00190000090114971860168524522114675860000102656"
          ],
          "expect": {
            "returns": "00190.00009 01149.718601 68524.522114 6 75860000102656"
          },
          "note": "JavaScript docs example"
        },
        {
          "id": "boleto.format#[null]",
          "args": [
            null
          ],
          "expect": {
            "returns": ""
          },
          "note": "JavaScript's own test: should return an empty string when the value is nullish"
        }
      ]
    },
    {
      "id": "boleto.generate",
      "level": "extended",
      "summary": "Generates a valid random boleto number.",
      "description": "Generates a valid random boleto number.\n\n- By default, the function generates a 47-digit cobrança bancária linha digitável. With `params.type` set to arrecadação, it generates a 48-digit boleto de arrecadação instead.\n- A cobrança bancária slip gets a random 3-digit bank code, the código de moeda `9` (real) and a fator de vencimento of `0000` (no due date) or `1000` to `9999`. Factors `0001` to `0999` denote no date and are never drawn.\n- A boleto de arrecadação draws its segment from 1 to 7 (segment 9 is the banks' own) and its value identifier from all four values (`6` and `8` for an effective amount, `7` and `9` for a reference quantity), so `hasEffectiveValue` can be `true` or false.\n- `boleto.isValid` accepts the result.\n- It draws with `Math.random()`, so it is not cryptographically secure. Do not use it for security purposes.",
      "params": [
        {
          "name": "params",
          "type": "GenerateBoletoParams",
          "optional": true
        }
      ],
      "returns": "string",
      "cases": [
        {
          "id": "boleto.generate#generated-is-valid",
          "args": [],
          "expect": {
            "satisfies": "boleto.isValid"
          },
          "repeat": 5,
          "note": "every generated value must pass the lib's own validator"
        },
        {
          "id": "boleto.generate#[{\"type\":\"arrecadacao\"}]",
          "args": [
            {
              "type": "arrecadacao"
            }
          ],
          "expect": {
            "matches": "^8\\d{47}$"
          },
          "note": "JavaScript docs example: a 48-digit boleto de arrecadação"
        },
        {
          "id": "boleto.generate#[{\"type\":\"bancario\"}]",
          "args": [
            {
              "type": "bancario"
            }
          ],
          "expect": {
            "matches": "^\\d{47}$"
          },
          "note": "JavaScript's own test: should keep generating bancário bank slips by default"
        }
      ]
    },
    {
      "id": "boleto.getInfo",
      "level": "extended",
      "summary": "Extracts information from a boleto.",
      "description": "Extracts the amount, due date and bank code from a boleto: the 47-digit linha digitável or the 44-digit barcode of a cobrança bancária slip, or a boleto de arrecadação. Returns `null` when the value is not a valid boleto.\n\n- The result has `amount` (in cents), `expirationDate` and `bankCode` (the 3-digit COMPE code).\n- The due date is `null` when the boleto carries no fator de vencimento (a factor below 1000).\n- The fator de vencimento cycle reset on 2025-02-22, so a factor maps to two dates 9000 days apart. No FEBRABAN or Banco Central publication tells the cycles apart; the rule comes from bank manuals. `options.referenceDate` resolves the cycle as of that date instead of today. Pass it whenever the answer has to stay stable, since the same slip can resolve to the other date as time passes.\n- The window around `referenceDate` is 3000 days back and 5500 days ahead, and the nearer candidate wins when neither falls inside it. A slip due up to 3499 days (about 9.5 years) before `referenceDate` keeps its date. One due 3500 days (about 9.6 years) or more before it is read as the next cycle (a date in the future). To read an old slip, pass a `referenceDate` near its issue date. The search never goes below the first cycle, so an older `referenceDate` still resolves a factor to the oldest date it can denote, never one before the 1997-10-07 base date.\n- A `referenceDate` that is not a valid `Date` (an invalid Date, a string, a number, `null`) is ignored and today is used. The call never throws. Until 2.4.0 an invalid Date gave the 1997 base date and a string or a number threw.\n- The 44-digit barcode is read for the same fields as the linha digitável: the amount from positions 10 to 19 and the fator de vencimento from positions 6 to 9. Until 2.4.0 a cobrança bancária barcode gave `null`. A value that is not a string gives `null`.\n- A 44-digit value that starts with `8` is always read as an arrecadação barcode, never as a cobrança bancária one: it gives the arrecadação result when it is a valid arrecadação barcode and `null` otherwise, even when it would be a valid barcode of a bank `8xx`.\n- A boleto de arrecadação has no bank code and no due date: `bankCode` is `\"\"` and `expirationDate` is `null`. It also has `type` (`\"arrecadacao\"`), `segment` (1 to 7, or 9 for the banks' own use), `value` (the amount in reais, `amount` divided by 100) and `hasEffectiveValue` (whether the amount is an effective value or a reference quantity).\n- A FEBRABAN \"Situação 2\" slip (bank `988`, código de moeda `0`, see `boleto.isValid`) carries the issuer's 8-digit ISPB where the amount would be. The result has `ispb` set to that ISPB, `amount` set to 0 and `expirationDate` `null`. `ispb` is new in 2.5.0 and is absent on every other slip.\n- It returns `null` exactly when `boleto.isValid` returns `false`, so a slip with a código de moeda other than `9` gives `null` (2.4.0 decoded it).",
      "params": [
        {
          "name": "value",
          "type": "string"
        },
        {
          "name": "options",
          "type": "GetBoletoInfoOptions",
          "optional": true
        }
      ],
      "returns": "BoletoInfo?",
      "cases": [
        {
          "id": "boleto.getInfo#[\"\"]",
          "args": [
            ""
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null when boleto is empty string"
        },
        {
          "id": "boleto.getInfo#[\"00190000090114971860168524522114775860000102656\"]",
          "args": [
            "00190000090114971860168524522114775860000102656"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: should return null when boleto is invalid"
        },
        {
          "id": "boleto.getInfo#[\"00170000010114971860168524522114275860000102656\"]",
          "args": [
            "00170000010114971860168524522114275860000102656"
          ],
          "expect": {
            "returns": null
          },
          "note": "changed in 2.5.0 (#593): código de moeda 7 is not valid (only 9, Carta-Circular BCB 2.926/2000), so the getter returns null. 2.4.0 decoded this slip"
        },
        {
          "id": "boleto.getInfo#[\"98800000060114971860168524522114100000018236120\"]",
          "args": [
            "98800000060114971860168524522114100000018236120"
          ],
          "expect": {
            "returns": {
              "amount": 0,
              "expirationDate": null,
              "bankCode": "988",
              "ispb": "18236120"
            }
          },
          "note": "JavaScript's own test: should read the ISPB of a FEBRABAN Convenção da Cobrança Situação 2 slip (bank 988, moeda 0, factor 0000) instead of an amount"
        },
        {
          "id": "boleto.getInfo#[\"abc\"]",
          "args": [
            "abc"
          ],
          "expect": {
            "returns": null
          }
        },
        {
          "id": "boleto.getInfo#[\"846100000005246100291102005460339004695895061080\"]",
          "args": [
            "846100000005246100291102005460339004695895061080"
          ],
          "expect": {
            "returns": {
              "amount": 2461,
              "expirationDate": null,
              "bankCode": "",
              "type": "arrecadacao",
              "segment": 4,
              "value": 24.61,
              "hasEffectiveValue": true
            }
          },
          "note": "JavaScript's own test: arrecadação (FEBRABAN Layout Padrão de Arrecadação §11 Formulário Padrão fixture: R$ 24,61, segment 4) should parse the linha digitável"
        },
        {
          "id": "boleto.getInfo#[\"80491758600001026560000001149718606852452211\"]",
          "args": [
            "80491758600001026560000001149718606852452211"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: when a 44 digit value starting with 8 is not an arrecadação barcode (bank 804 cobrança bancária)"
        },
        {
          "id": "boleto.getInfo#[\"84610000000246100291100054603390069589506109\"]",
          "args": [
            "84610000000246100291100054603390069589506109"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test (isValidBoleto): a 44 digit value starting with 8 that fits neither layout is read as an arrecadação barcode and is not a boleto"
        },
        {
          "id": "boleto.getInfo#[\"abc00190000090114971860168524522114675860000102656zzz\"]",
          "args": [
            "abc00190000090114971860168524522114675860000102656zzz"
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: isValidBoleto rejects letters around the digits, so there is no info"
        },
        {
          "id": "boleto.getInfo#[\"00191000000001026560000001149718606852452211\"]",
          "args": [
            "00191000000001026560000001149718606852452211"
          ],
          "expect": {
            "returns": {
              "amount": 102656,
              "expirationDate": null,
              "bankCode": "001"
            }
          },
          "note": "JavaScript's own test: when it is a cobrança bancária barcode with no factor"
        },
        {
          "id": "boleto.getInfo#[\"98801000000182361200000001149718606852452211\"]",
          "args": [
            "98801000000182361200000001149718606852452211"
          ],
          "expect": {
            "returns": {
              "amount": 0,
              "expirationDate": null,
              "bankCode": "988",
              "ispb": "18236120"
            }
          },
          "note": "JavaScript's own test: when it is a Situação 2 barcode, reading the ISPB from positions 12 to 19"
        },
        {
          "id": "boleto.getInfo#[\"84610000000246100291100054603390069589506108\"]",
          "args": [
            "84610000000246100291100054603390069589506108"
          ],
          "expect": {
            "returns": {
              "amount": 2461,
              "expirationDate": null,
              "bankCode": "",
              "type": "arrecadacao",
              "segment": 4,
              "value": 24.61,
              "hasEffectiveValue": true
            }
          },
          "note": "JavaScript's own test: arrecadação: should parse the código de barras"
        },
        {
          "id": "boleto.getInfo#[\"84610000000-5 24610029110-2 00546033900-4 69589506108-0\"]",
          "args": [
            "84610000000-5 24610029110-2 00546033900-4 69589506108-0"
          ],
          "expect": {
            "returns": {
              "amount": 2461,
              "expirationDate": null,
              "bankCode": "",
              "type": "arrecadacao",
              "segment": 4,
              "value": 24.61,
              "hasEffectiveValue": true
            }
          },
          "note": "JavaScript's own test: arrecadação: should parse a formatted linha digitável"
        },
        {
          "id": "boleto.getInfo#[\"847900000005246100291102005460339004695895061080\"]",
          "args": [
            "847900000005246100291102005460339004695895061080"
          ],
          "expect": {
            "returns": {
              "amount": 2461,
              "expirationDate": null,
              "bankCode": "",
              "type": "arrecadacao",
              "segment": 4,
              "value": 24.61,
              "hasEffectiveValue": false
            }
          },
          "note": "JavaScript's own test: arrecadação: should flag a reference value"
        },
        {
          "id": "boleto.getInfo#[123]",
          "args": [
            123
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: when boleto is not a string, never undefined, as every other getter answers"
        },
        {
          "id": "boleto.getInfo#[null]",
          "args": [
            null
          ],
          "expect": {
            "returns": null
          },
          "note": "JavaScript's own test: when boleto is not a string, never undefined, as every other getter answers"
        }
      ]
    },
    {
      "id": "boleto.isValid",
      "level": "core",
      "summary": "Checks whether a boleto number is valid.",
      "description": "Validates a boleto: the 47-digit cobrança bancária linha digitável or its 44-digit barcode, or a boleto de arrecadação as its 48-digit linha digitável or 44-digit barcode.\n\n- The function verifies every check digit of the chosen layout (per Carta-Circular BCB 2.926/2000 and the FEBRABAN arrecadação layout).\n- The código de moeda (position 4 of the barcode and of the linha digitável) must be `9` (real), the only code Carta-Circular BCB 2.926/2000 assigns. 2.4.0 accepted any digit there.\n- The one exception is the FEBRABAN Convenção da Cobrança \"Situação 2\" slip of an institution identified only by its ISPB: bank code `988`, código de moeda `0`, fator de vencimento `0000`, and the ISPB padded with zeros to 10 digits in barcode positions 10 to 19, where the amount would be. Bank `988` with código de moeda `9` is an ordinary slip.\n- The cobrança bancária barcode has 44 digits: bank code, código de moeda `9`, the módulo 11 check digit in position 5, fator de vencimento, amount and free field. It is checked by the same rules as the linha digitável. Until 2.4.0 this barcode was rejected.\n- A 44-digit value that starts with `8` is only ever an arrecadação barcode (the `8` is its product identifier). A cobrança bancária barcode of a bank code `8xx` is not accepted, because the two layouts could not be told apart.\n- The mask characters (whitespace, `.`, `-` and `/`) are accepted between digits, a run of them included, and whitespace around the value. Any other character makes the value invalid: letters, punctuation or a mask character leading or trailing the digits. So a linha digitável wrapped in letters is rejected. Until 2.4.0 every non-digit was dropped.\n- A value that is not a string is invalid.",
      "params": [
        {
          "name": "value",
          "type": "string"
        }
      ],
      "returns": "boolean",
      "cases": [
        {
          "id": "boleto.isValid#[\"60757135008571297205909229083648919190488862573\"]",
          "args": [
            "60757135008571297205909229083648919190488862573"
          ],
          "expect": {
            "returns": false
          },
          "note": "changed in 2.5.0 (#593): the check digits are right, but the código de moeda in position 4 is 7; only 9 (real) is valid (Carta-Circular BCB 2.926/2000). 2.4.0 accepted any digit there, and the go, ruby and rust libs still do"
        },
        {
          "id": "boleto.isValid#[\"60757135008571297205909229083648919190488862574\"]",
          "args": [
            "60757135008571297205909229083648919190488862574"
          ],
          "expect": {
            "returns": false
          },
          "note": "consensus of 4 libs (go, javascript, ruby, rust)"
        },
        {
          "id": "boleto.isValid#[\"00000000000000000000000000000000000000000000000\"]",
          "args": [
            "00000000000000000000000000000000000000000000000"
          ],
          "expect": {
            "returns": false
          },
          "note": "consensus of 4 libs (go, javascript, ruby, rust)"
        },
        {
          "id": "boleto.isValid#[\"52410567606343146479903680440595729289409535291\"]",
          "args": [
            "52410567606343146479903680440595729289409535291"
          ],
          "expect": {
            "returns": false
          },
          "note": "changed in 2.5.0 (#593): the check digits are right, but the código de moeda in position 4 is 0 and the slip is not a FEBRABAN Situação 2 slip (bank 988); only 9 (real) is valid (Carta-Circular BCB 2.926/2000). 2.4.0 accepted any digit there, and the go, ruby and rust libs still do"
        },
        {
          "id": "boleto.isValid#[\"52410567606343146479903680440595729289409535292\"]",
          "args": [
            "52410567606343146479903680440595729289409535292"
          ],
          "expect": {
            "returns": false
          },
          "note": "consensus of 4 libs (go, javascript, ruby, rust)"
        },
        {
          "id": "boleto.isValid#[\"74348924801607065591119728853342723148482264669\"]",
          "args": [
            "74348924801607065591119728853342723148482264669"
          ],
          "expect": {
            "returns": false
          },
          "note": "changed in 2.5.0 (#593): the check digits are right, but the código de moeda in position 4 is 8; only 9 (real) is valid (Carta-Circular BCB 2.926/2000). 2.4.0 accepted any digit there, and the go, ruby and rust libs still do"
        },
        {
          "id": "boleto.isValid#[\"74348924801607065591119728853342723148482264660\"]",
          "args": [
            "74348924801607065591119728853342723148482264660"
          ],
          "expect": {
            "returns": false
          },
          "note": "consensus of 4 libs (go, javascript, ruby, rust)"
        },
        {
          "id": "boleto.isValid#[\"60757.13500 85712.972059 09229.083648 9 19190488862573\"]",
          "args": [
            "60757.13500 85712.972059 09229.083648 9 19190488862573"
          ],
          "expect": {
            "returns": false
          },
          "note": "changed in 2.5.0 (#593): the check digits are right, but the código de moeda in position 4 is 7; only 9 (real) is valid (Carta-Circular BCB 2.926/2000). 2.4.0 accepted any digit there, and the go, ruby and rust libs still do"
        },
        {
          "id": "boleto.isValid#[\"52410.56760 63431.464799 03680.440595 7 29289409535291\"]",
          "args": [
            "52410.56760 63431.464799 03680.440595 7 29289409535291"
          ],
          "expect": {
            "returns": false
          },
          "note": "changed in 2.5.0 (#593): the check digits are right, but the código de moeda in position 4 is 0 and the slip is not a FEBRABAN Situação 2 slip (bank 988); only 9 (real) is valid (Carta-Circular BCB 2.926/2000). 2.4.0 accepted any digit there, and the go, ruby and rust libs still do"
        },
        {
          "id": "boleto.isValid#[\"74348.92480 16070.655911 19728.853342 7 23148482264669\"]",
          "args": [
            "74348.92480 16070.655911 19728.853342 7 23148482264669"
          ],
          "expect": {
            "returns": false
          },
          "note": "changed in 2.5.0 (#593): the check digits are right, but the código de moeda in position 4 is 8; only 9 (real) is valid (Carta-Circular BCB 2.926/2000). 2.4.0 accepted any digit there, and the go, ruby and rust libs still do"
        },
        {
          "id": "boleto.isValid#[\"\"]",
          "args": [
            ""
          ],
          "expect": {
            "returns": false
          },
          "note": "consensus of 4 libs (go, javascript, ruby, rust)"
        },
        {
          "id": "boleto.isValid#[\"   \"]",
          "args": [
            "   "
          ],
          "expect": {
            "returns": false
          },
          "note": "consensus of 4 libs (go, javascript, ruby, rust)"
        },
        {
          "id": "boleto.isValid#[\"abc\"]",
          "args": [
            "abc"
          ],
          "expect": {
            "returns": false
          },
          "note": "consensus of 4 libs (go, javascript, ruby, rust)"
        },
        {
          "id": "boleto.isValid#[\"123456789\"]",
          "args": [
            "123456789"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false"
        },
        {
          "id": "boleto.isValid#[\"00190000020114971860168524522114675860000102656\"]",
          "args": [
            "00190000020114971860168524522114675860000102656"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when check digit mod10 is invalid"
        },
        {
          "id": "boleto.isValid#[\"00190000090114971860168524522114975860000102656\"]",
          "args": [
            "00190000090114971860168524522114975860000102656"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false check digit mod11 is invalid"
        },
        {
          "id": "boleto.isValid#[\"00190000090114971860168524522114675860000102656999\"]",
          "args": [
            "00190000090114971860168524522114675860000102656999"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false"
        },
        {
          "id": "boleto.isValid#[\"00190000090114971860168524522114675860000102656\"]",
          "args": [
            "00190000090114971860168524522114675860000102656"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true when is a boleto valid without mask"
        },
        {
          "id": "boleto.isValid#[\"0019000009 01149.718601 68524.522114 6 75860000102656\"]",
          "args": [
            "0019000009 01149.718601 68524.522114 6 75860000102656"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true when is a boleto valid with mask"
        },
        {
          "id": "boleto.isValid#[\"00170000010114971860168524522114275860000102656\"]",
          "args": [
            "00170000010114971860168524522114275860000102656"
          ],
          "expect": {
            "returns": false
          },
          "note": "changed in 2.5.0 (#593). JavaScript's own test: should return false when the código de moeda is not 9 (moeda 7, check digits recalculated); Carta-Circular BCB 2.926/2000 assigns only 9 (real). 2.4.0 returned true"
        },
        {
          "id": "boleto.isValid#[\"00180000000114971860168524522114475860000102656\"]",
          "args": [
            "00180000000114971860168524522114475860000102656"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when the código de moeda is not 9 (moeda 8, check digits recalculated)"
        },
        {
          "id": "boleto.isValid#[\"0017000001 01149.718601 68524.522114 2 75860000102656\"]",
          "args": [
            "0017000001 01149.718601 68524.522114 2 75860000102656"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when the código de moeda is not 9 (moeda 7, masked)"
        },
        {
          "id": "boleto.isValid#[\"00100000080114971860168524522114175860000102656\"]",
          "args": [
            "00100000080114971860168524522114175860000102656"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when the código de moeda is 0 outside the FEBRABAN Situação 2 layout"
        },
        {
          "id": "boleto.isValid#[\"00100000080114971860168524522114800000018236120\"]",
          "args": [
            "00100000080114971860168524522114800000018236120"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for moeda 0 with bank 001 instead of 988 (Situação 2 layout not followed)"
        },
        {
          "id": "boleto.isValid#[\"98800000060114971860168524522114775860018236120\"]",
          "args": [
            "98800000060114971860168524522114775860018236120"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for bank 988, moeda 0 with factor 7586 instead of 0000 (Situação 2 layout not followed)"
        },
        {
          "id": "boleto.isValid#[\"98800000060114971860168524522114700001018236120\"]",
          "args": [
            "98800000060114971860168524522114700001018236120"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false for bank 988, moeda 0 when barcode positions 10 and 11 are not the zeros that pad the ISPB"
        },
        {
          "id": "boleto.isValid#[\"98800000060114971860168524522114100000018236120\"]",
          "args": [
            "98800000060114971860168524522114100000018236120"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true for a FEBRABAN Convenção da Cobrança Situação 2 slip: bank 988, moeda 0, factor 0000 and ISPB 18236120 padded with zeros"
        },
        {
          "id": "boleto.isValid#[\"98890000070114971860168524522114975860000102656\"]",
          "args": [
            "98890000070114971860168524522114975860000102656"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true when bank 988 uses the código de moeda 9"
        },
        {
          "id": "boleto.isValid#[\"836200000005667800481000180975657313001589636081\"]",
          "args": [
            "836200000005667800481000180975657313001589636081"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true for the mcrvaz/boleto-brasileiro-validator modulus 10 linha digitável fixture"
        },
        {
          "id": "boleto.isValid#[\"846300000003299902962024004101360008002006441147\"]",
          "args": [
            "846300000003299902962024004101360008002006441147"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true for the mrmgomes/boleto-utils modulus 10 linha digitável fixture"
        },
        {
          "id": "boleto.isValid#[\"858900004609524601791605607593050865831483000010\"]",
          "args": [
            "858900004609524601791605607593050865831483000010"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true when it is a valid modulo 11 linha digitável"
        },
        {
          "id": "boleto.isValid#[\"848900000002404201622015806051904292586034111220\"]",
          "args": [
            "848900000002404201622015806051904292586034111220"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true when it is a valid modulo 11 linha digitável"
        },
        {
          "id": "boleto.isValid#[\"858000000070438403281922630720192528304729600523\"]",
          "args": [
            "858000000070438403281922630720192528304729600523"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true when it is a valid modulo 11 linha digitável"
        },
        {
          "id": "boleto.isValid#[\"838600000050096000190009000801782309000343062712\"]",
          "args": [
            "838600000050096000190009000801782309000343062712"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true when it is a valid modulo 11 linha digitável"
        },
        {
          "id": "boleto.isValid#[\"858200000007572503282030560708202107539591904460\"]",
          "args": [
            "858200000007572503282030560708202107539591904460"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true when it is a valid modulo 11 linha digitável"
        },
        {
          "id": "boleto.isValid#[\"85890000460524601791606075930508683148300001\"]",
          "args": [
            "85890000460524601791606075930508683148300001"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true for the barcode form of the FEBRABAN §11 modulus 10 example"
        },
        {
          "id": "boleto.isValid#[\"84610000000-5 24610029110-2 00546033900-4 69589506108-0\"]",
          "args": [
            "84610000000-5 24610029110-2 00546033900-4 69589506108-0"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação should return true when it has a mask"
        },
        {
          "id": "boleto.isValid#[\"abc00190000090114971860168524522114675860000102656zzz\"]",
          "args": [
            "abc00190000090114971860168524522114675860000102656zzz"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when letters or other stray characters surround or split an otherwise valid value"
        },
        {
          "id": "boleto.isValid#[\"00190000090114971860168524522114675860000102656x\"]",
          "args": [
            "00190000090114971860168524522114675860000102656x"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when letters or other stray characters surround or split an otherwise valid value"
        },
        {
          "id": "boleto.isValid#[\"00190.00009 01149.718601 68524.522114 6 7586000010265,6\"]",
          "args": [
            "00190.00009 01149.718601 68524.522114 6 7586000010265,6"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when letters or other stray characters surround or split an otherwise valid value"
        },
        {
          "id": "boleto.isValid#[\"(00190000090114971860168524522114675860000102656)\"]",
          "args": [
            "(00190000090114971860168524522114675860000102656)"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when letters or other stray characters surround or split an otherwise valid value"
        },
        {
          "id": "boleto.isValid#[\"846100000005246100291102005460339004695895061080\\n!\"]",
          "args": [
            "846100000005246100291102005460339004695895061080\n!"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when letters or other stray characters surround or split an otherwise valid value"
        },
        {
          "id": "boleto.isValid#[\"8461000000a05246100291102005460339004695895061080\"]",
          "args": [
            "8461000000a05246100291102005460339004695895061080"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when letters or other stray characters surround or split an otherwise valid value"
        },
        {
          "id": "boleto.isValid#[\".00190000090114971860168524522114675860000102656\"]",
          "args": [
            ".00190000090114971860168524522114675860000102656"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a mask character leads or trails the digits, or is the whole value"
        },
        {
          "id": "boleto.isValid#[\"00190000090114971860168524522114675860000102656-\"]",
          "args": [
            "00190000090114971860168524522114675860000102656-"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a mask character leads or trails the digits, or is the whole value"
        },
        {
          "id": "boleto.isValid#[\" . - / \"]",
          "args": [
            " . - / "
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: should return false when a mask character leads or trails the digits, or is the whole value"
        },
        {
          "id": "boleto.isValid#[\"  00190.00009 - 01149.718601 / 68524.522114 . 6 - 75860000102656\\n\"]",
          "args": [
            "  00190.00009 - 01149.718601 / 68524.522114 . 6 - 75860000102656\n"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true when the mask uses any of the mask characters, a run of them or surrounding whitespace"
        },
        {
          "id": "boleto.isValid#[\"00190/00009/01149/718601/68524/522114/6/75860000102656\"]",
          "args": [
            "00190/00009/01149/718601/68524/522114/6/75860000102656"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: should return true when the mask uses any of the mask characters, a run of them or surrounding whitespace"
        },
        {
          "id": "boleto.isValid#[\"00196758600001026560000001149718606852452211\"]",
          "args": [
            "00196758600001026560000001149718606852452211"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return true when it is the barcode of the boleto valid without mask (new in 2.5.0, rejected until 2.4.0)"
        },
        {
          "id": "boleto.isValid#[\"00192100000001026560000001149718606852452211\"]",
          "args": [
            "00192100000001026560000001149718606852452211"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return true when it has other check digits, from the same fields"
        },
        {
          "id": "boleto.isValid#[\"00191000000001026560000001149718606852452211\"]",
          "args": [
            "00191000000001026560000001149718606852452211"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return true when it has other check digits, from the same fields"
        },
        {
          "id": "boleto.isValid#[\"00196758600000000000000001149718606852452211\"]",
          "args": [
            "00196758600000000000000001149718606852452211"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return true when it has other check digits, from the same fields"
        },
        {
          "id": "boleto.isValid#[\"0019.6 75860000102656 0000001149718606852452211\"]",
          "args": [
            "0019.6 75860000102656 0000001149718606852452211"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return true when it has a mask"
        },
        {
          "id": "boleto.isValid#[\"98801000000182361200000001149718606852452211\"]",
          "args": [
            "98801000000182361200000001149718606852452211"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return true when it is a Situação 2 barcode (bank 988, moeda 0, factor 0000, ISPB 18236120)"
        },
        {
          "id": "boleto.isValid#[\"00191758600001026560000001149718606852452211\"]",
          "args": [
            "00191758600001026560000001149718606852452211"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when the check digit is wrong"
        },
        {
          "id": "boleto.isValid#[\"00190758600001026560000001149718606852452211\"]",
          "args": [
            "00190758600001026560000001149718606852452211"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when the check digit is wrong"
        },
        {
          "id": "boleto.isValid#[\"00196758600001026570000001149718606852452211\"]",
          "args": [
            "00196758600001026570000001149718606852452211"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when a field changed and the check digit did not"
        },
        {
          "id": "boleto.isValid#[\"00196758600001026560000001149718606852452212\"]",
          "args": [
            "00196758600001026560000001149718606852452212"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when a field changed and the check digit did not"
        },
        {
          "id": "boleto.isValid#[\"00172758600001026560000001149718606852452211\"]",
          "args": [
            "00172758600001026560000001149718606852452211"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when the código de moeda is not 9 (moeda 7 with its own check digit)"
        },
        {
          "id": "boleto.isValid#[\"98801000100182361200000001149718606852452211\"]",
          "args": [
            "98801000100182361200000001149718606852452211"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when the Situação 2 layout is broken (the factor is not zeros)"
        },
        {
          "id": "boleto.isValid#[\"0019675860000102656000000114971860685245221\"]",
          "args": [
            "0019675860000102656000000114971860685245221"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when the length is 43 or 45"
        },
        {
          "id": "boleto.isValid#[\"001967586000010265600000011497186068524522110\"]",
          "args": [
            "001967586000010265600000011497186068524522110"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when the length is 43 or 45"
        },
        {
          "id": "boleto.isValid#[\"80491758600001026560000001149718606852452211\"]",
          "args": [
            "80491758600001026560000001149718606852452211"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when it starts with 8, since a 44-digit value starting with 8 is an arrecadação barcode only (bank 804 with a valid check digit)"
        },
        {
          "id": "boleto.isValid#[\"84610000000246100291100054603390069589506109\"]",
          "args": [
            "84610000000246100291100054603390069589506109"
          ],
          "expect": {
            "returns": false
          },
          "note": "JavaScript's own test: cobrança bancária barcode: should return false when it is a 44-digit value starting with 8 that fits neither layout"
        },
        {
          "id": "boleto.isValid#[\"84610000000246100291100054603390069589506108\"]",
          "args": [
            "84610000000246100291100054603390069589506108"
          ],
          "expect": {
            "returns": true
          },
          "note": "JavaScript's own test: arrecadação: should return true for the barcode form of the FEBRABAN §11 modulus 10 example"
        }
      ]
    },
    {
      "id": "boleto.parse",
      "level": "extended",
      "summary": "Removes the formatting characters of a boleto and returns only the digits.",
      "description": "Removes every character that is not a digit from a boleto (mask, spaces, letters) and returns the digits, without checking that the boleto is valid.\n\n- The result is cut to 47 digits, or to 48 when the digits start with `8` (boleto de arrecadação). Digits beyond that are dropped.\n- A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number gives an empty string (2.4.0 read the digits of any number).",
      "params": [
        {
          "name": "value",
          "type": "string | number"
        }
      ],
      "returns": "string",
      "cases": [
        {
          "id": "boleto.parse#masked",
          "args": [
            "10491.44338 55119.000002 00000.000141 3 25230000093423"
          ],
          "expect": {
            "returns": "10491443385511900000200000000141325230000093423"
          }
        },
        {
          "id": "boleto.parse#arrecadacao-masked",
          "args": [
            "84610000000-5 24610029110-2 00546033900-4 69589506108-0"
          ],
          "expect": {
            "returns": "846100000005246100291102005460339004695895061080"
          }
        },
        {
          "id": "boleto.parse#empty",
          "args": [
            ""
          ],
          "expect": {
            "returns": ""
          }
        },
        {
          "id": "boleto.parse#[\"10491.44A338 55119.000002? ABC00000.000?141 3 25230000093423\"]",
          "args": [
            "10491.44A338 55119.000002? ABC00000.000?141 3 25230000093423"
          ],
          "expect": {
            "returns": "10491443385511900000200000000141325230000093423"
          },
          "note": "JavaScript's own test: should remove non numeric characters"
        },
        {
          "id": "boleto.parse#[\"10491443385511900000200000000141325230000093423123\"]",
          "args": [
            "10491443385511900000200000000141325230000093423123"
          ],
          "expect": {
            "returns": "10491443385511900000200000000141325230000093423"
          },
          "note": "JavaScript's own test: should ignore digits after the boleto length"
        },
        {
          "id": "boleto.parse#[\"846100000005246100291102005460339004695895061080123\"]",
          "args": [
            "846100000005246100291102005460339004695895061080123"
          ],
          "expect": {
            "returns": "846100000005246100291102005460339004695895061080"
          },
          "note": "JavaScript's own test: arrecadação should ignore digits after the arrecadação length"
        },
        {
          "id": "boleto.parse#[-1]",
          "args": [
            -1
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule. JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        },
        {
          "id": "boleto.parse#[1.5]",
          "args": [
            1.5
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule. JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        },
        {
          "id": "boleto.parse#[9007199254740992]",
          "args": [
            9007199254740992
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule (2 ** 53 is not a safe integer). JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        },
        {
          "id": "boleto.parse#[1e+21]",
          "args": [
            1e+21
          ],
          "expect": {
            "returns": ""
          },
          "note": "#593 number rule. JavaScript's own test: should return an empty string when it is a negative, fractional or unsafe number"
        }
      ]
    }
  ]
}
