Skip to content

Commit

Permalink
Factorizes the forOwnAttributes (#282)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBuchholz committed Aug 28, 2018
1 parent 92d65ef commit 257aabb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/define/class/attributes/consolidate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
/*#ifndef(UMD)*/
"use strict";
/*global _GpfClassDefinition*/ // Class definition
/*global _gpfArrayForEach*/ // Almost like [].forEach (undefined are also enumerated)
/*global _gpfObjectForEach*/ // Similar to [].forEach but for objects
/*global _GPF_DEFINE_CLASS_ATTRIBUTES_NAME*/ // $attributes
/*#endif*/

function _gpfDefClassAttrFilter (attributes, baseAttributeClass) {
Expand Down Expand Up @@ -45,6 +47,20 @@ Object.assign(_GpfClassDefinition.prototype, {
}
},

_forOwnAttributes: function (callback, lastParam) {
var me = this,
ownAttributes = me._getOwnAttributes();
_gpfObjectForEach(ownAttributes, function (attributes, name) {
var member;
if (_GPF_DEFINE_CLASS_ATTRIBUTES_NAME !== name) {
member = name;
}
_gpfArrayForEach(attributes, function (attribute) {
callback.call(me, member, attribute, lastParam);
});
});
},

/**
* Retrieve all attributes for this class definition (including inherited ones)
*
Expand Down

0 comments on commit 257aabb

Please sign in to comment.