Subtheme of barrio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

25 lines
474 B

'use strict';
var reduce = require('object.reduce');
var validateRegistry = require('./helpers/validateRegistry');
function setTasks(inst, task, name) {
inst.set(name, task);
return inst;
}
function registry(newRegistry) {
if (!newRegistry) {
return this._registry;
}
validateRegistry(newRegistry);
var tasks = this._registry.tasks();
this._registry = reduce(tasks, setTasks, newRegistry);
this._registry.init(this);
}
module.exports = registry;