Skip to content
Rogain module registry.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.babelrc
.gitignore
.npmignore
LICENSE
README.md
package.json

README.md

rogain-config

Use to configure module required by rogain templating tools.

Config

The Config class creates a set of Registry instances for managing the components and filters that are used by Rogain tools.

// create a config 
var config = new Config();

// register modules to config registers
config.components.register({
    Button: require('./components/Button.json'),
    Form: require('./components/Form.json')
});

config.filters.register('uppercase', require('./filters/uppercase'));

get(type)

Returns a plain object representing the Config instance. Optional type argument can be passed to get a specific config registry.

config.get() // => { components: { }, filters: { } }
config.get('components') // => { Button: { ... }, Form: { ... } }

Registry

The Registry class creates a dictonary for managing modules.

var components = new Registry()

components.register('If', require('./components/helpers/If'));
components.register('Heading', require('./components/Heading'));

components.unregister('If');

get(name)

gets selected registry data. passing a name will return the matching module or undefined if not found. If called with no arguments get will return all modules as a plain object.

components.get('If') // => module
components.get() // => { name: module }

register(name, module)

components.register('Repeat', require('./components/helpers/Repeat'));

register(modules)

components.register({
    Pass: require('./components/helpers/Pass'),
    Fail: require('./components/helpers/Fail')
})

unregister(name)

components.unregister('Repeat');

Install

With npm do:

npm install rogain-config

License

MIT

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.