Sha256: 11d75368ecf26a5b3396e0c3506a4dec145b11ef0d0e330dff6145c3181a5f94
Contents?: true
Size: 874 Bytes
Versions: 5
Compression:
Stored size: 874 Bytes
Contents
function makeRegistry( base ) { return { _data: {}, add: function(name, func) { // precautionary case conversion, as later querying of // the registry by function-caller uses lower case as well. name = name.toLowerCase(); if (this._data.hasOwnProperty(name)) { //TODO warn } this._data[name] = func; }, addMultiple: function(functions) { Object.keys(functions).forEach( function(name) { this.add(name, functions[name]); }.bind(this)); }, get: function(name) { return this._data[name] || ( base && base.get( name )); }, inherit : function() { return makeRegistry( this ); } }; } module.exports = makeRegistry( null );
Version data entries
5 entries across 5 versions & 2 rubygems