CNO

Cadastro Nacional de Obras, the registration of construction works with the Receita Federal (replaced the CEI for them, same numbering).

  • Parity matrix

Validate

Validates a CNO. The CNO replaced the CEI for construction works and kept its numbering.

  • Same rules as cei.isValid.
  • A number is read only when it is a safe non-negative integer. A negative, fractional, non-finite or unsafe number is invalid.
  • No official source publishes the check digit rule. Only the 12 positions and the CNO keeping the CEI number (Manual de Orientação do eSocial S-1.3, item 9.1) are official. The IN RFB 2.061/2021 has no check digit, and the eSocial only checks that the number exists in the Receita Federal base. The rule comes from third-party reference implementations, cross-checked against the CNO open data and SERPRO's example 000000336854.
  • A number loses its leading zeros, so a value that starts with 0 is only accepted as a string: "000000336854" is valid and 336854 is not.

Check if a CNO (Cadastro Nacional de Obras) number is valid. The CNO replaced the CEI for construction works and kept its numbering.

  • Same rules as isValidCei, the leading zeros of a number included.
import { isValidCno } from '@brazilian-utils/brazilian-utils';

isValidCno('11.084.01680/62'); // true
isValidCno('111130137368'); // true
isValidCno(401800097960); // true
isValidCno(-401800097960); // false (not a non-negative safe integer)
isValidCno('110840168063'); // false (invalid check digit)
isValidCno('000000000000'); // false (repeated digits)

Source: CNO page of the Receita Federal, SERPRO, CNO cadastro, eSocial MOS S-1.3, item 9.1 and the CNO open dataset.

Shared test cases (22) and the result in each library cno.isValid

Format

Formats a CNO with the mask 00.000.00000/00 (the CEI numbering).

  • Same rules as cei.format: the mask is applied as far as the digits go, and digits beyond the 12th are dropped. options.pad first left-pads with zeros to 12 digits.
  • 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, sign and decimal point dropped).
  • options.pad on a value with no digits ("", "---", null) still gives an empty string. Until 2.4.0 "" and "---" gave the whole zero mask.

Format a CNO (Cadastro Nacional de Obras) number.

  • Same rules as formatCei: the 00.000.00000/00 mask, with pad in FormatCnoOptions.
import { formatCno } from '@brazilian-utils/brazilian-utils';

formatCno('111130137368'); // 11.113.01373/68
formatCno(401800097960); // 40.180.00979/60
formatCno('979', { pad: true }); // 00.000.00009/79
Shared test cases (20) and the result in each library cno.format

Parse

Removes CNO formatting and keeps only digits, capped at 12 digits.

  • 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, sign and decimal point dropped).

Remove CNO (Cadastro Nacional de Obras) formatting, keep only digits, and cap the result to 12 digits, the numbering the CNO kept from the CEI.

import { parseCno } from '@brazilian-utils/brazilian-utils';

parseCno('11.113.01373/68'); // '111130137368'
Shared test cases (9) and the result in each library cno.parse

Official sources

See also CEI, CAEPF

Last updated on

On this page