JSFiddle - React, Tailwind, and code Playground
by Leo Cavalcante
JavaScript
//Module Pattern ou Pattern Modular em JS
(function(global) {
var Nome = function() {
return {
setPattern: function(data) {
return pattern = data;
},
setNome: function(value) {
return nome = value;
},
getPattern: function() {
return pattern;
},
getNome: function() {
return nome;
},
getResultado: function() {
return Nome.getPattern().test(Nome.getNome());
}
};
}(Nome);
global.Nome = Nome;
})(this);
(function(global) {
var Telephone = function() {
return {
setPattern: function(data) {
return pattern = data;
},
setTelephone: function(value) {
return telephone = value;
},
getPattern: function() {
return pattern;
},
getTelephone: function() {
return telephone;
},
getResultado: function() {
return Telephone.getPattern().test(Telephone.getTelephone());
}
};
}(Telephone);
global.Telephone = Telephone;
})(this);
(function(global) {
var Cep = function() {
return {
setPattern: function(data) {
return pattern = data;
},
setCep: function(value) {
return cep = value;
},
getPattern: function() {
return pattern;
},
getCep: function() {
return cep;
},
getResultado: function() {
return Cep.getPattern().test(Cep.getCep());
}
};
}(Cep);
global.Cep = Cep;
})(this);
(function(global) {
var Email = function() {
return {
setPattern: function(data) {
return pattern = data;
...