basespace

Functions to create namespaces inside objects

basespace

Functions to create namespaces inside objects.

npm install basespace

Component

component install gamtiq/basespace

Jam

jam install basespace

Bower

bower install basespace

SPM

spm install numgen

Use dist/basespace.js or dist/basespace.min.js (minified version).

var ns = require("basespace");
...
require(["basespace"], function(ns) {
    ...
});
define(["path/to/dist/basespace.js"], function(ns) {
    ...
});
<!-- Use bower_components/basespace/dist/basespace.js if the library was installed via Bower -->
<script type="text/javascript" src="path/to/dist/basespace.js"></script>
<script type="text/javascript">
    // basespace is available via basespace field of window object 
    var ns = basespace;
    ...
</script> 
var app = {
    space: ns.space
};
ns(["model", "ui.dialog", "ui.list", "ui.list.cyclic", "util"], app);
app.space("ui.menu", "template");
app.space("data").util = {...};

Create specified namespaces inside context if they do not exist. context is global object (i.e. window in browser) by default. value specifies a value that will be assigned to a final field. {} by default.

Return the value for the last of created names/fields.

Create the specified namespace inside this object.

Return the value for the last of created names/fields.

MIT