Skip to content

Comment on Closures for class/module privacy considered harmful

Comments

i really wish there was a good alternative to this, because I sometimes find myself wanting to write tests for some of my private functions, which just don't really have any need to be exported.

*edit : i should add i have been making use of the fact that a lot of my modules are event emitters to work around this. so even if i don't expose the function as such, i trigger the event rather than use the function directly.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.