diff --git a/framework/core/js/admin/dist/app.js b/framework/core/js/admin/dist/app.js index eb2e3fcc1..16a08b91b 100644 --- a/framework/core/js/admin/dist/app.js +++ b/framework/core/js/admin/dist/app.js @@ -23425,14 +23425,25 @@ System.register("flarum/utils/ItemList", [], function (_export, _context) { } /** - * Check whether an item is present in the list. + * Check whether the list is empty. * - * @param key * @returns {boolean} + * @public */ babelHelpers.createClass(ItemList, [{ + key: "isEmpty", + value: function isEmpty() { + for (var i in this.items) { + if (this.items.hasOwnProperty(i)) { + return false; + } + } + + return true; + } + }, { key: "has", value: function has(key) { return !!this.items[key]; diff --git a/framework/core/js/forum/dist/app.js b/framework/core/js/forum/dist/app.js index 4bcdd072e..16374dc0b 100644 --- a/framework/core/js/forum/dist/app.js +++ b/framework/core/js/forum/dist/app.js @@ -31837,14 +31837,25 @@ System.register("flarum/utils/ItemList", [], function (_export, _context) { } /** - * Check whether an item is present in the list. + * Check whether the list is empty. * - * @param key * @returns {boolean} + * @public */ babelHelpers.createClass(ItemList, [{ + key: "isEmpty", + value: function isEmpty() { + for (var i in this.items) { + if (this.items.hasOwnProperty(i)) { + return false; + } + } + + return true; + } + }, { key: "has", value: function has(key) { return !!this.items[key]; diff --git a/framework/core/js/lib/utils/ItemList.js b/framework/core/js/lib/utils/ItemList.js index 042315dfd..1a08890aa 100644 --- a/framework/core/js/lib/utils/ItemList.js +++ b/framework/core/js/lib/utils/ItemList.js @@ -20,6 +20,22 @@ export default class ItemList { this.items = {}; } + /** + * Check whether the list is empty. + * + * @returns {boolean} + * @public + */ + isEmpty() { + for (const i in this.items) { + if(this.items.hasOwnProperty(i)) { + return false; + } + } + + return true; + } + /** * Check whether an item is present in the list. *