Skip to content

Instantly share code, notes, and snippets.

@riquellopes
Created November 12, 2012 12:22
Show Gist options
  • Save riquellopes/4059072 to your computer and use it in GitHub Desktop.
Save riquellopes/4059072 to your computer and use it in GitHub Desktop.
Validar faixa de preços
var Faixa = {
criterios:{
1:{reg:/^([1-9]|[1-9][0-9]|1[0-4][0-9]|15[0])$/, label:'1-150'},
2:{reg:/^(15[1-9]|1[6-9][0-9]|2[0-4][0-9]|25[0])$/, label:'151-250'},
3:{reg:/^(25[1-9]|2[6-9][0-9]|3[0-4][0-9]|35[0])$/, label:'251-350'},
4:{reg:/^(35[1-9]|3[6-9][0-9]|4[0-4][0-9]|45[0])$/, label:'351-450'},
5:{reg:/^(45[1-9]|4[6-9][0-9]|5[0-4][0-9]|55[0])$/, label:'451-550'},
6:{reg:/^(55[1-9]|[6-9][0-9][0-9]|[1-4][0-9][0-9][0-9]?[0-9])$/, label:'>551'}
},
execs:function(cri, value)
{
return this.criterios[cri].reg.test(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment