mframejs
Version:
simple framework
29 lines • 988 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
var exported_1 = require("../interface/exported");
function bindable(options) {
var _options;
_options = options;
return function (target, key) {
if (!target[exported_1.CONSTANTS.META_BINDABLE]) {
target[exported_1.CONSTANTS.META_BINDABLE] = {};
}
var attribute = key.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/\s+/g, '-')
.toLowerCase();
if (options) {
if (!options.attribute) {
options.attribute = attribute;
}
}
if (!target[exported_1.CONSTANTS.META_BINDABLE][key]) {
target[exported_1.CONSTANTS.META_BINDABLE][key] = {
key: key,
options: _options || {
attribute: attribute
}
};
}
};
}
exports.bindable = bindable;
//# sourceMappingURL=bindable.js.map