CSOSN
Código de Situação da Operação no Simples Nacional: the tax situation codes of Simples Nacional operations.
Validate
- JavaScript library
- Python library
- Go library1 case fails
- Ruby library
- Rust library1 case fails
- .NET library
- Erlang library
Checks whether a CSOSN is one of the 10 codes of the official table: 101, 102, 103, 201, 202, 203, 300, 400, 500, 900.
- Accepts the bare 3 digits as a string, or a non-negative integer. A CSOSN has no printed grouping, so the function rejects a masked value.
- Surrounding whitespace is ignored. Any other string is rejected: the function does not pick out its digits (
"abc101"). - Nothing is padded: no code starts with a zero, so a value narrower than 3 digits is not a code. A number is read only when it is a safe non-negative integer.
- No behavior change in 2.5.0.
- Source: Anexo III-A of Convênio SINIEF s/nº 1970 (table instituted by Ajuste SINIEF 03/2010).
| Parameter | Type | Required |
|---|---|---|
value | string | number | yes |
| returns | boolean |
Check if a CSOSN (Código de Situação da Operação no Simples Nacional) code is one of the 10 codes of the official table: 101, 102, 103, 201, 202, 203, 300, 400, 500 or 900.
- Accepts a string with the bare 3 digits, or a number. A CSOSN has no printed grouping, so
'1-01'is rejected.
import { isValidCsosn } from '@brazilian-utils/brazilian-utils';
isValidCsosn('101'); // true
isValidCsosn(900); // true
isValidCsosn('999'); // false
isValidCsosn('abc101'); // false (not a documented form)
isValidCsosn(-101); // false (not a non-negative safe integer)Source: consolidated Anexo III-A of Convênio SINIEF s/nº 1970 and Ajuste SINIEF 03/2010.
Code: brazilian-utils/javascriptTry it with JavaScript isValidCsosn
Shared test cases (26) and the result in each library csosn.isValid
Official sources
- confaz.fazenda.gov.br/legislacao/ajustes/…/cvsn_70
- confaz.fazenda.gov.br/legislacao/ajustes/…/aj_003_10
See also CST
Last updated on
