@pedidopago/ui 1.12.7 → 1.12.8

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.
@@ -1 +1 @@
1
- {"version":3,"file":"cnpj.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/cnpj.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAuBlD"}
1
+ {"version":3,"file":"cnpj.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/cnpj.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAuBlD"}
@@ -2,7 +2,8 @@
2
2
  * This function takes in a string representing a Brazilian CNPJ number and returns a formatted string in the standard CNPJ format (e.g. "12.345.678/0001-90").
3
3
  * @param {string} text - The string representing the Brazilian CNPJ number.
4
4
  * @returns {string} - A formatted string in the standard CNPJ format.
5
- */function formatCnpj(text){return text.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/,"$1.$2.$3/$4-$5")}/**
5
+ */function formatCnpj(text){// Remove any non-numeric characters from the string and take the first 11 digits
6
+ var sanitizedCnpj=text.replace(/[^\d*]/g,"").substring(0,14);return sanitizedCnpj.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/,"$1.$2.$3/$4-$5")}/**
6
7
  * This function takes in a string representing a Brazilian CNPJ number and returns a sanitized string without any non-numeric characters, with a maximum length of 14 characters.
7
8
  * @param {string} cnpj - The string representing the Brazilian CNPJ number.
8
9
  * @returns {string} - A sanitized string without any non-numeric characters, with a maximum length of 14 characters.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pedidopago/ui",
3
- "version": "1.12.7",
3
+ "version": "1.12.8",
4
4
  "description": "Quick build beatiful Pedido Pago apps",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",