global-doc-ident
Advanced tools
Comparing version 1.0.3 to 1.0.4
18
index.js
@@ -6,3 +6,3 @@ /** | ||
* @ Modified by: Your name | ||
* @ Modified time: 2021-01-13 13:53:06 | ||
* @ Modified time: 2021-01-14 09:44:08 | ||
*/ | ||
@@ -25,3 +25,3 @@ /* | ||
module.exports = (docnumber, country = 'br') => { | ||
module.exports = (docnumber = '00000000000', country = 'br') => { | ||
@@ -34,3 +34,5 @@ country = country.replace(/[0-9]/g, '').substring(0, 2).toLowerCase() | ||
return Object.assign(require('./' + country + '/index')(docnumber), { | ||
country: countries[country.toUpperCase()], module: 'Used for ' + country | ||
country: countries[country.toUpperCase()], | ||
length: docnumber.length, | ||
module: 'Used for ' + country | ||
}) | ||
@@ -41,3 +43,7 @@ } catch (error) { | ||
module: 'Used standard br for Brazil!', | ||
error: error.message | ||
length: docnumber.length, | ||
error: { | ||
country: support[country] = false, | ||
suported: ['br'] | ||
} | ||
}) | ||
@@ -47,3 +53,5 @@ } | ||
return Object.assign(require('./br/index')(docnumber), { | ||
country: countries[country.toUpperCase()], module: 'Used standard br for Brazil!' | ||
country: countries[country.toUpperCase()], | ||
length: length, | ||
module: 'Used standard br for Brazil!' | ||
}) | ||
@@ -50,0 +58,0 @@ } |
{ | ||
"name": "global-doc-ident", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "\"JavaScript identifier and validator for the number of Brazilian documents such as CPF and CNPJ returned in object as formatted version.\"", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -14,3 +14,3 @@ # br-doc-identfier | ||
``` | ||
const DocIdent = require('./index') | ||
const DocIdent = require('global-doc-ident') | ||
@@ -17,0 +17,0 @@ console.log(DocIdent('000.000.001-91')) //CPF Default Brazil |
16628
423