JSPM

namespace-generator

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q27854F
  • License MIT

The namespace NPM will take a starting directory and build out objects and modules that are in a given directory structure.

Package Exports

  • namespace-generator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (namespace-generator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Namespace Generator

Build Status

The namespace NPM will take a starting directory and build out objects and modules that are in a given directory structure. The purpose of this module is so that you can establish a directory for various modules and not have to worry about linking them together. Specifically statically referencing modules in an index.js or something equivalent.

Usage

myModule.js

var namespace = require('solid-namespace');
namespace(path.join(__dirname, '../my-modules'))
    .then(function(ns){
            //`ns` object is fully loaded with an organized object based off of your file system

            //examples (see tests)
            ns['test-start']; //should.equal('lets get ready to rumble');
            ns.dir1.test1(); //should.equal('i am test1');
            ns.dir1.test2.test2a(); //should.equal('i am test2a');
            ns.dir1.test2.test2b(); //should.equal('i am test2b');
            ns.dir2.testa.testa; //should.equal('i am test a');
            ns.dir2.testb.testb; //should.equal('i am test b');
            ns.dir1.subdir1['test-z']; //should.equal('i am test-z');
        });

See tests for full example

Built with love by Solid Digital

Solid is addicted to digital, fanatic about mobile and intrigued by the Internet of things.

At Solid, we create digital products and services that will transform our physical world.

Let's chat @http://solid.ws