Befor generating

This commit is contained in:
marys
2026-06-01 13:17:37 +02:00
parent 3383f4bf4a
commit 1aa1b5f625
6756 changed files with 649946 additions and 1 deletions
+46
View File
@@ -0,0 +1,46 @@
const { getMapValueByKey } = require('../models/utils');
/**
* Implements functions to deal with the common Bindings object.
* @mixin
*/
const MixinBindings = {
/**
* @returns {boolean}
*/
hasBindings() {
return !!(this._json.bindings && Object.keys(this._json.bindings).length);
},
/**
* @returns {Object}
*/
bindings() {
return this.hasBindings() ? this._json.bindings : {};
},
/**
* @returns {string[]}
*/
bindingProtocols() {
return Object.keys(this.bindings());
},
/**
* @param {string} name - Name of the binding.
* @returns {boolean}
*/
hasBinding(name) {
return this.hasBindings() && !!this._json.bindings[String(name)];
},
/**
* @param {string} name - Name of the binding.
* @returns {(Object | null)}
*/
binding(name) {
return getMapValueByKey(this._json.bindings, name);
},
};
module.exports = MixinBindings;