Remove use of non-standard list comprehension syntax

This commit is contained in:
Tom Najdek 2016-10-16 15:24:04 +01:00 committed by Dan Stillman
parent 03b1b75bfb
commit 39bc5398c9
4 changed files with 15 additions and 7 deletions

View File

@ -384,8 +384,8 @@ var Zotero_LocateMenu = new function() {
return _getURL(item).then((val) => val !== false); return _getURL(item).then((val) => val !== false);
} }
this.handleItems = Zotero.Promise.coroutine(function* (items, event) { this.handleItems = Zotero.Promise.coroutine(function* (items, event) {
var urls = yield Zotero.Promise.all([for (item of items) _getURL(item)]); var urls = yield Zotero.Promise.all(items.map(item => _getURL(item)));
ZoteroPane_Local.loadURI([for (url of urls) if (url) url], event); ZoteroPane_Local.loadURI(urls.filter(url => !!url), event);
}); });
var _getURL = Zotero.Promise.coroutine(function* (item) { var _getURL = Zotero.Promise.coroutine(function* (item) {

View File

@ -70,7 +70,10 @@ var Zotero_Tag_Color_Chooser = new function() {
} }
else { else {
// Get unused color at random // Get unused color at random
var usedColors = [for (x of tagColors.values()) x.color]; var usedColors = [];
for (let x of tagColors.values()) {
usedColors.push(x.color);
}
var unusedColors = Zotero.Utilities.arrayDiff( var unusedColors = Zotero.Utilities.arrayDiff(
colorPicker.colors, usedColors colorPicker.colors, usedColors
); );

View File

@ -71,7 +71,12 @@ Zotero.QuickCopy = new function() {
+ "WHERE setting='quickCopySite'"; + "WHERE setting='quickCopySite'";
var rows = yield Zotero.DB.queryAsync(sql); var rows = yield Zotero.DB.queryAsync(sql);
// Unproxify storage row // Unproxify storage row
_siteSettings = [for (row of rows) { domainPath: row.domainPath, format: row.format }]; _siteSettings = rows.map(row => {
return {
domainPath: row.domainPath,
format: row.format
};
});
}); });

View File

@ -231,10 +231,10 @@ ZoteroAutoComplete.prototype.startSearch = Zotero.Promise.coroutine(function* (s
if (resultsCallback) { if (resultsCallback) {
resultsCallback(results); resultsCallback(results);
this.updateResults( this.updateResults(
[for (x of results) x.val], Object.values(results).map(x => x.val),
[for (x of results) x.comment], Object.values(results).map(x => x.comment),
false false
) );
} }
resultCode = null; resultCode = null;
Zotero.debug("Autocomplete query completed"); Zotero.debug("Autocomplete query completed");