Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-hur Santos Ott committed Dec 12, 2017
1 parent 56de29c commit 93b1499
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ const Textfield = MKTextField.textfield()
.withPlaceholder('Text...')
.withStyle(styles.textfield)
.build()

;<TextInputMask
ref={'myDateText'}
type={'money'}
Expand Down Expand Up @@ -393,7 +392,7 @@ var money = MaskService.toMask('money', '123', {

## 1.6.5

* Fixing validation for CPF and CNPJ when empty string is inputed.
* Fixing validation for CPF and CNPJ when empty string is inputed. (thanks to [gabuael](https://github.com/gabuael))

## 1.6.4

Expand Down
5 changes: 3 additions & 2 deletions dist/lib/masks/cnpj.mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var dig2=new Number();
var i=0;

var exp=/\.|\-|\//g;
cnpj=cnpj.toString().replace(exp,"");
cnpj=cnpj.toString().replace(exp,'');
var digito=new Number(eval(cnpj.charAt(12)+cnpj.charAt(13)));

for(i=0;i<valida.length;i++){
Expand All @@ -36,5 +36,6 @@ return _get(CnpjMask.prototype.__proto__||Object.getPrototypeOf(CnpjMask.prototy
}},{key:'validate',value:function validate(

value,settings){
return validateCnpj(value);
var isEmpty=(value||'').trim().length===0;
return!isEmpty&&validateCnpj(value);
}}],[{key:'getType',value:function getType(){return'cnpj';}}]);return CnpjMask;}(_base2.default);exports.default=CnpjMask;
21 changes: 17 additions & 4 deletions dist/lib/masks/cpf.mask.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,31 @@ Object.defineProperty(exports,"__esModule",{value:true});var _createClass=functi
var CPF_MASK='999.999.999-99';

var validateCPF=function validateCPF(cpf){
if(cpf==""){
if(cpf==''){
return true;
}

cpf=cpf.replace(/\./gi,"").replace(/-/gi,"");
cpf=cpf.replace(/\./gi,'').replace(/-/gi,'');
var isValid=true;
var sum;
var rest;
var i;
i=0;
sum=0;

if(cpf.length!=11||cpf=="00000000000"||cpf=="11111111111"||cpf=="22222222222"||cpf=="33333333333"||cpf=="44444444444"||cpf=="55555555555"||cpf=="66666666666"||cpf=="77777777777"||cpf=="88888888888"||cpf=="99999999999"){
if(
cpf.length!=11||
cpf=='00000000000'||
cpf=='11111111111'||
cpf=='22222222222'||
cpf=='33333333333'||
cpf=='44444444444'||
cpf=='55555555555'||
cpf=='66666666666'||
cpf=='77777777777'||
cpf=='88888888888'||
cpf=='99999999999')
{
isValid=false;
}

Expand Down Expand Up @@ -65,5 +77,6 @@ return _get(CpfMask.prototype.__proto__||Object.getPrototypeOf(CpfMask.prototype
}},{key:'validate',value:function validate(

value,settings){
return validateCPF(value);
var isEmpty=(value||'').trim().length===0;
return!isEmpty&&validateCPF(value);
}}],[{key:'getType',value:function getType(){return'cpf';}}]);return CpfMask;}(_base2.default);exports.default=CpfMask;

0 comments on commit 93b1499

Please sign in to comment.