Plato on Github
Report Home
src/attributes/uniqueattribute.js
Maintainability
92.39
Lines of code
33
Difficulty
4.24
Estimated Errors
0.06
Function weight
By Complexity
By SLOC
/** * @file gpf.attributes.UniqueAttribute attribute * @since 0.2.8 */ /*#ifndef(UMD)*/ "use strict"; /*global _gpfAttributesAttributeAttribute*/ // Shortcut for gpf.attributes.AttributeAttribute /*global _gpfAttributesCheckAppliedOnlyOnce*/ // Ensures attribute is used only once /*global _gpfDefine*/ // Shortcut for gpf.define /*exported _gpfAttributesUniqueAttribute*/ // Shortcut for gpf.attributes.UniqueAttribute /*#endif*/ /** * Attribute to restrict the use of an attribute to only once * It throws {@link gpf.Error.UniqueAttributeUsedTwice} if the target attribute is used more than once at any level. * * @class gpf.attributes.UniqueAttribute * @extends gpf.attributes.Attribute * @gpf:attribute-restriction attribute,class,unique * @since 0.2.8 */ var _gpfAttributesUniqueAttribute = _gpfDefine({ $class: "gpf.attributes.UniqueAttribute", $extend: _gpfAttributesAttributeAttribute, $singleton: true, _targetCheck: function (member, classDefinition, targetAttribute) { _gpfAttributesCheckAppliedOnlyOnce(member, classDefinition, targetAttribute.constructor); } }); gpf.attributes.UniqueAttribute = _gpfAttributesUniqueAttribute;