Skip to content

Instantly share code, notes, and snippets.

@sdougbrown
Created October 26, 2016 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdougbrown/9ce62e9f32b00286ddbaacd1a5456a71 to your computer and use it in GitHub Desktop.
Save sdougbrown/9ce62e9f32b00286ddbaacd1a5456a71 to your computer and use it in GitHub Desktop.
Boolean gettersetter w/ pre-bound callbacks
function is(bool) {
function gs() {
if (arguments.length) {
bool = arguments[0];
}
return !!bool;
};
gs.setTrue = () => gs(true);
gs.setFalse = () => gs(false);
return gs;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment