mirror of
https://github.com/flarum/framework.git
synced 2025-02-21 09:53:27 +08:00
Add isEmpty function to ItemList (#1218)
* Add isEmpty function to ItemList * Fix coding style to be consistent. * Recompiled app.js for both js/admin/ and js/forum/
This commit is contained in:
parent
1349f146d5
commit
3517d4e86c
15
framework/core/js/admin/dist/app.js
vendored
15
framework/core/js/admin/dist/app.js
vendored
@ -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];
|
||||
|
15
framework/core/js/forum/dist/app.js
vendored
15
framework/core/js/forum/dist/app.js
vendored
@ -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];
|
||||
|
@ -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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user