@thefoxjob/js-meta
Version:
Stores meta data of various kinds about given target classes or methods
58 lines (41 loc) • 2.19 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Data = require('./Data');
var _Data2 = _interopRequireDefault(_Data);
var _jsMixin = require('@thefoxjob/js-mixin');
var _jsMixin2 = _interopRequireDefault(_jsMixin);
var _DependenciesAware = require('./../Mixins/DependenciesAware');
var _DependenciesAware2 = _interopRequireDefault(_DependenciesAware);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
/**
* @class Meta Class Data
*
* @description Holds arbitrary data about a given class
*
* @extends Data
*
* @author Alin Eugen Deac <aedart@gmail.com>
*/
var ClassData = function (_mix$with) {
_inherits(ClassData, _mix$with);
/**
* @constructor
*
* @param {Function|Object} target
* @param {Object} [data] Key value pairs
*
* @throws {InvalidTarget}
*/
function ClassData(target) {
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
_classCallCheck(this, ClassData);
return _possibleConstructorReturn(this, (ClassData.__proto__ || Object.getPrototypeOf(ClassData)).call(this, target, data));
}
return ClassData;
}((0, _jsMixin2.default)(_Data2.default).with(_DependenciesAware2.default));
exports.default = ClassData;