@spalger/kibana
Version:
Kibana is an open source (Apache Licensed), browser based analytics and search dashboard for Elasticsearch. Kibana is a snap to setup and start using. Kibana strives to be easy to get started with, while also being flexible and powerful, just like Elastic
47 lines (39 loc) • 1.16 kB
JavaScript
define(function (require) {
return function (_) {
// create a property descriptor for properties
// that won't change
function describeConst(val) {
return {
writable: false,
enumerable: false,
configurable: false,
value: val
};
}
var props = {
inherits: describeConst(function (SuperClass) {
var prototype = Object.create(SuperClass.prototype, {
constructor: describeConst(this),
superConstructor: describeConst(SuperClass)
});
Object.defineProperties(this, {
prototype: describeConst(prototype),
Super: describeConst(SuperClass)
});
return this;
})
};
_.mixin(_, {
/**
* Add class-related behavior to a function, currently this
* only attaches an .inherits() method.
*
* @param {Constructor} ClassConstructor - The function that should be extended
* @return {Constructor} - the constructor passed in;
*/
class: function (ClassConstructor) {
return Object.defineProperties(ClassConstructor, props);
}
});
};
});