mframejs
Version:
simple framework
27 lines • 859 B
JavaScript
import { CONSTANTS } from '../interface/exported';
export function bindable(options) {
let _options;
_options = options;
return function (target, key) {
if (!target[CONSTANTS.META_BINDABLE]) {
target[CONSTANTS.META_BINDABLE] = {};
}
const attribute = key.replace(/([a-z])([A-Z])/g, '$1-$2')
.replace(/\s+/g, '-')
.toLowerCase();
if (options) {
if (!options.attribute) {
options.attribute = attribute;
}
}
if (!target[CONSTANTS.META_BINDABLE][key]) {
target[CONSTANTS.META_BINDABLE][key] = {
key: key,
options: _options || {
attribute: attribute
}
};
}
};
}
//# sourceMappingURL=bindable.js.map