Skip to content

Instantly share code, notes, and snippets.

@occ
Last active December 11, 2015 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save occ/4588575 to your computer and use it in GitHub Desktop.
Save occ/4588575 to your computer and use it in GitHub Desktop.
var ShieldJS = function(options) {
// Private variables
var alphabetically,
ordered,
var1,
var2;
// Construtor
function constructor(o) {
// Process options, etc.
}(options);
// Internal functions
var doSomething = function() {
};
// Public functions and getters/setters
var getVar1 = function() {
return var1;
};
var setVar1 = function(v) {
var1 = v;
};
var sayHello = function(name) {
return "Hello, " + name;
};
return {
getVar1: getVar1,
setVar1: setVar1,
sayHello: sayHello
}
}
var s = new ShieldJS();
var greeting = s.sayHello("occ");
@eriwen
Copy link

eriwen commented Jan 21, 2013

How would we test internal functions? Should we?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment