1.0.2 • Published 11 years ago

ns v1.0.2

Weekly downloads
48
License
-
Repository
github
Last release
11 years ago

namespace

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.

Install

npm install ns

then require the module in your application code

var namespace = require('ns');

or in your browser simply add the namespace.js to your script sources

<script type="text/javascript" src="namespace.js"></script>

Useage

Define a new namespace and assign a function

namespace('company.hello.world', function() {
  console.log('Hello World');
});

now you can run the function in any of your scripts which have access to the same window/global object

namespace('company.hello.world')(); // => Hello World

Licence

The project is licenced under the conditions of the MIT licence.