Underscore.js _.map() to native Array.map() (optional with Object.entries/values)

This commit is contained in:
djmaze 2020-07-22 20:09:31 +02:00
parent 032fa8c736
commit a82575a830
27 changed files with 68 additions and 78 deletions

View file

@ -202,8 +202,7 @@ class MessageModel extends AbstractModel {
getEmails(properties) {
return _.compact(
_.uniq(
_.map(
_.reduce(properties, (carry, property) => carry.concat(this[property]), []),
_.reduce(properties, (carry, property) => carry.concat(this[property]), []).map(
(oItem) => (oItem ? oItem.email : '')
)
)
@ -628,7 +627,7 @@ class MessageModel extends AbstractModel {
* @returns {string}
*/
attachmentsToStringLine() {
const attachLines = _.map(this.attachments(), (item) => item.fileName + ' (' + item.friendlySize + ')');
const attachLines = this.attachments().map(item => item.fileName + ' (' + item.friendlySize + ')');
return attachLines && 0 < attachLines.length ? attachLines.join(', ') : '';
}