jcinfo-utils 1.0.55 → 1.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env CHANGED
@@ -1,4 +1,4 @@
1
1
  # apenas para testar a função updateDotEnv() & updateDotEnvKey()
2
2
  # REACT_APP_VERSION=1.0 (1116.1)
3
- VITE_VERSION=1.0 (327.29)
3
+ VITE_VERSION=1.0 (404.3)
4
4
  VITE_VDATE=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jcinfo-utils",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "Pacote de funções utilitárias",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -14,6 +14,9 @@ const CNPJ_ZERADO = '00000000000000'
14
14
  const CARACTERES_PERMITIDOS = 'ABCDEGHJKLMNPRSTUVWXYZ0123456789'
15
15
  const CARACTERES_MASCARA = new Set(['.', '/', ' ', '-'])
16
16
 
17
+ // Regex derivado de CARACTERES_PERMITIDOS
18
+ const REGEX_CARACTERE_PERMITIDO = /^[ABCDEGHJKLMNPRSTUVWXYZ0-9]$/
19
+
17
20
  // ─── helpers internos ────────────────────────────────────────────────────────
18
21
 
19
22
  function isCaracterePermitido(c) {
@@ -29,19 +32,31 @@ function isDigito(c) {
29
32
  return /^[0-9]$/.test(c)
30
33
  }
31
34
 
32
- function temCaracteresNaoPermitidos(str) {
33
- return [...str].some((c) => !isCaracterePermitido(c))
35
+ function isCNPJSemDVValido(str) {
36
+ return /^[A-Z0-9]{12}$/.test(str)
34
37
  }
35
38
 
36
39
  function removeCaracteresMascara(str) {
37
- return [...str].filter((c) => !CARACTERES_MASCARA.has(c)).join('')
40
+ return str.replace(/[./ -]/g, '')
38
41
  }
39
42
 
40
- function isCNPJSemDVValido(str) {
41
- if (str.length !== TAMANHO_CNPJ_SEM_DV) return false
42
- return [...str].every((c) => isAlfaNumerico(c))
43
+ function temCaracteresNaoPermitidos(str) {
44
+ return /[^ABCDEGHJKLMNPRSTUVWXYZ0-9]/.test(str)
43
45
  }
44
46
 
47
+ // function isCNPJSemDVValido(str) {
48
+ // if (str.length !== TAMANHO_CNPJ_SEM_DV) return false
49
+ // return [...str].every((c) => isAlfaNumerico(c))
50
+ // }
51
+
52
+ // function removeCaracteresMascara(str) {
53
+ // return [...str].filter((c) => !CARACTERES_MASCARA.has(c)).join('')
54
+ // }
55
+
56
+ // function temCaracteresNaoPermitidos(str) {
57
+ // return [...str].some((c) => !isCaracterePermitido(c))
58
+ // }
59
+
45
60
  function isCNPJComDVValido(str) {
46
61
  if (str.length !== TAMANHO_CNPJ_COMPLETO) return false
47
62
  for (let i = 0; i < TAMANHO_CNPJ_SEM_DV; i++) {