www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 7fa931425afdc0fb9e99281cc148cf710b7ea060
parent 3c81067961924caeb36a763a376d90dba0a34859
Author: Dan Stillman <dstillman@zotero.org>
Date:   Fri, 10 Oct 2014 04:32:23 -0400

Rename Zotero.Item.prototype.getCreatorsAPIData() to getCreatorsJSON

And add Zotero.Item.prototype.setCreators()

Diffstat:
Mchrome/content/zotero/xpcom/data/item.js | 14++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js @@ -952,7 +952,7 @@ Zotero.Item.prototype.getCreators = function () { * @return {Array<Object>} An array of creator data objects in API JSON format * ('firstName'/'lastName' or 'name', 'creatorType') */ -Zotero.Item.prototype.getCreatorsAPIData = function () { +Zotero.Item.prototype.getCreatorsJSON = function () { this._requireData('creators'); return this._creators.map(function (data) Zotero.Creators.internalToJSON(data)); } @@ -1010,6 +1010,16 @@ Zotero.Item.prototype.setCreator = function (orderIndex, data) { } +/** + * @param {Object[]} data - An array of creator data in internal or API JSON format + */ +Zotero.Item.prototype.setCreators = function (data) { + for (let i = 0; i < data.length; i++) { + this.setCreator(i, data[i]); + } +} + + /* * Remove a creator and shift others down */ @@ -4166,7 +4176,7 @@ Zotero.Item.prototype.toJSON = Zotero.Promise.coroutine(function* (options, patc // Creators if (this.isRegularItem()) { yield this.loadCreators() - obj.creators = this.getCreatorsAPIData(); + obj.creators = this.getCreatorsJSON(); } else { var parent = this.parentKey;