bixbyjs/bixby-common

View on GitHub
lib/data/index.js

Summary

Maintainability
A
0 mins
Test Coverage
function Data() {
  this._types = {};
  this._exts = {};
  this._stack = [];
}

Data.prototype.use = function(type, ext, impl) {
  if (typeof ext != 'string') {
    impl = ext;
    ext = undefined;
  }
  
  this._types[type] = impl;
  if (ext) { this._exts[ext] = impl; }
  this._stack.push(type);
}

Data.prototype.getTypes = function() {
  return Object.keys(this._types);
}

Data.prototype.getExtensions = function() {
  return Object.keys(this._exts);
}


exports = module.exports = Data;