Organize your code in namespaces
This package provides namespaces for your nodejs or browser app. It help's you organizing your code without writing wired variable constructs and helper objects.
npm install ns
then require the module in your application code
var namespace = ;
or in the browser simply add the
namespace.js to your script sources
Define a new namespace and assign a function
now you can run the function in any of your scripts which have access to the same window/global object.
A namespace can contain everything. Objects, functions and even variables - string, integer, float, ...
; // => Hello World
When you assign any kind of variable, object or function to a namespace it won't be stored in the namespace scope.
It is attached on nodejs to the
global var and in your local browser to
window. These variables are reachable for all code in your application.
So you may access the namespace defined as follows:
in this way:
globalhelloworld // => Hello Worldwindowhelloworld // => Hello World
The project is licensed under the conditions of the MIT licence.