@bildvitta/quasar-ui-asteroid 3.19.0-beta.10 → 3.19.0-beta.11

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bildvitta/quasar-ui-asteroid",
3
3
  "description": "Asteroid",
4
- "version": "3.19.0-beta.10",
4
+ "version": "3.19.0-beta.11",
5
5
  "author": "Bild & Vitta <systemteam@bild.com.br>",
6
6
  "license": "MIT",
7
7
  "main": "./src/asteroid.js",
@@ -61,8 +61,22 @@ function formatPercent (value = 0, places = 2) {
61
61
  return value ? value.toLocaleString('pt-BR', { style: 'percent', minimumFractionDigits: places }) : ''
62
62
  }
63
63
 
64
+ /**
65
+ * Formata documento de empresa (CNPJ) aplicando máscara XX.XXX.XXX/XXXX-XX
66
+ * Aceita caracteres alfanuméricos (letras e números)
67
+ *
68
+ * @param {string} value - String com 14 caracteres
69
+ * @returns {string} - String formatada como CNPJ
70
+ *
71
+ * @example
72
+ * formatCompanyDocument('12345678000195') // '12.345.678/0001-95'
73
+ * formatCompanyDocument('ODH8LCRV000146') // 'OD.H8L.CRV/0001-46'
74
+ */
64
75
  function formatCompanyDocument (value) {
65
- return value.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/g, '$1.$2.$3/$4-$5')
76
+ return value.replace(
77
+ /^([A-Za-z0-9]{2})([A-Za-z0-9]{3})([A-Za-z0-9]{3})([A-Za-z0-9]{4})([A-Za-z0-9]{2})/g,
78
+ '$1.$2.$3/$4-$5'
79
+ )
66
80
  }
67
81
 
68
82
  function formatDocument (value) {