@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 +1 -1
- package/src/helpers/filters.js +15 -1
package/package.json
CHANGED
package/src/helpers/filters.js
CHANGED
|
@@ -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(
|
|
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) {
|