In Java, we have 4 visibility levels. Except public and private, we have protected level and a default level (with no modifier) that is also called "package-local" or "package-private".
| Modifier | Class | Package | Subclass | World |
|---|---|---|---|---|
| public | Y | Y | Y | Y |
| protected | Y | Y | Y | X |
| no modifier | Y | Y | X | X |
| private | Y | X | X | X |
See: https://www.programcreek.com/2011/11/java-access-level-public-protected-private/
I especially need this "package-private" level in Javascript. Is there a similar way for Javascript modules?
I'm writing a library (NPM package) and I want to export something (function, class, etc.) but not in the module's public API (to be used by consumers of the library). Just to be used locally between my module's files.