Created
April 3, 2014 18:52
-
-
Save mbildner/9960529 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// During build, delete everything between start and end tags, keeping things safely scoped | |
// This exists for Grunt, and seems relatively easy to port to Gulp. | |
// https://github.com/philipwalton/grunt-strip-code/ | |
(function hasPrivateFunctions (window) { | |
this.isPublicFunction = isPublicFunction; | |
function isPublicFunction () { | |
return 'I am a public function'; | |
} | |
function isPrivateFunction () { | |
return 'I am a private function'; | |
} | |
/* start-testing-code-section */ | |
window.testableApiObject.isPrivateFunction = isPrivateFunction; | |
/* end-testing-code-section */ | |
})(window); | |
window.isPublicFunction() // 'I am a public function' | |
window.isPrivateFunction() // TypeError, this is good | |
window.testableApiObject.isPrivateFunction() // 'I am a private function' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment