Skip to content

Instantly share code, notes, and snippets.

@dutradotdev
Created March 17, 2019 23:49
Show Gist options
  • Save dutradotdev/b1304bb7cece6252e0f643670fcb0493 to your computer and use it in GitHub Desktop.
Save dutradotdev/b1304bb7cece6252e0f643670fcb0493 to your computer and use it in GitHub Desktop.
Revealing Module Pattern
(function(global){
const idade = 21;
const cpf = 13412312321;
function meuNomeQueSeraExposto() {
return 'Lucas';
}
function meuNomeQueNaoSeraExposto() {
return 'Lucas Muniz Dutra';
}
global.lucas = {
nome: meuNomeQueSeraExposto,
idade,
}
}(this));
/*
no console:
lucas.nome // 'Lucas'
lucas.idade // 21
lucas.cpf // undefined pois não exportamos este dado
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment