X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/fcecb8e0ed56cd955b1d2bcbc12e2675f40f0243..d1effc78cd6e71573f29f7901c598cabc3c2aaf8:/src/wlxml/extensions/metadata/metadata.js?ds=sidebyside diff --git a/src/wlxml/extensions/metadata/metadata.js b/src/wlxml/extensions/metadata/metadata.js index b30b94c..b19cd52 100644 --- a/src/wlxml/extensions/metadata/metadata.js +++ b/src/wlxml/extensions/metadata/metadata.js @@ -90,8 +90,16 @@ _.extend(Metadata.prototype, { } }), - forEach: function(callback) { - return this._rows.forEach(callback); + _iter: function(method, callback, key) { + return this._rows + .filter(function(row) { return !key || row.getKey() === key; }) + [method](function(row) { return callback(row); }); + }, + forEach: function(callback, key) { + return this._iter('forEach', callback, key); + }, + some: function(callback, key) { + return this._iter('some', callback, key); }, add: function(rowDesc, options) { var row;