Allow Zotero.Item instance instead of itemID in Collection.hasItem()
This commit is contained in:
parent
80f6b857f6
commit
5f07f36ae5
1 changed files with 9 additions and 4 deletions
|
@ -450,11 +450,16 @@ Zotero.Collection.prototype.removeItems = Zotero.Promise.coroutine(function* (it
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if an item belongs to the collection
|
* Check if an item belongs to the collection
|
||||||
**/
|
*
|
||||||
Zotero.Collection.prototype.hasItem = function(itemID) {
|
* @param {Zotero.Item|Number} item - Item or itemID
|
||||||
|
*/
|
||||||
|
Zotero.Collection.prototype.hasItem = function (item) {
|
||||||
this._requireData('childItems');
|
this._requireData('childItems');
|
||||||
return this._childItems.has(itemID);
|
if (item instanceof Zotero.Item) {
|
||||||
|
item = item.id;
|
||||||
|
}
|
||||||
|
return this._childItems.has(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue