DEV: removes _.map from codebase (#6616)
This commit is contained in:
parent
907cf3ee2f
commit
c4ed353fae
|
@ -27,7 +27,7 @@ EmailLog.reopenClass({
|
|||
|
||||
return ajax(`/admin/email/${status}.json?offset=${offset}`, {
|
||||
data: filter
|
||||
}).then(logs => _.map(logs, log => EmailLog.create(log)));
|
||||
}).then(logs => logs.map(log => EmailLog.create(log)));
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ IncomingEmail.reopenClass({
|
|||
return ajax(`/admin/email/${status}.json?offset=${offset}`, {
|
||||
data: filter
|
||||
}).then(incomings =>
|
||||
_.map(incomings, incoming => IncomingEmail.create(incoming))
|
||||
incomings.map(incoming => IncomingEmail.create(incoming))
|
||||
);
|
||||
},
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ const keyValueStore = new KeyValueStore("discourse_emojis_");
|
|||
const EMOJI_USAGE = "emojiUsage";
|
||||
const EMOJI_SELECTED_DIVERSITY = "emojiSelectedDiversity";
|
||||
const PER_ROW = 11;
|
||||
const customEmojis = _.map(_.keys(extendedEmojiList()), code => {
|
||||
const customEmojis = _.keys(extendedEmojiList()).map(code => {
|
||||
return { code, src: emojiUrlFor(code) };
|
||||
});
|
||||
|
||||
|
@ -148,7 +148,7 @@ export default Ember.Component.extend({
|
|||
$recentSection.css("height", "auto").show();
|
||||
}
|
||||
|
||||
const recentEmojis = _.map(this.get("recentEmojis"), code => {
|
||||
const recentEmojis = this.get("recentEmojis").map(code => {
|
||||
return { code, src: emojiUrlFor(code) };
|
||||
});
|
||||
const template = findRawTemplate("emoji-picker-recent")({ recentEmojis });
|
||||
|
@ -235,7 +235,7 @@ export default Ember.Component.extend({
|
|||
this.$results
|
||||
.empty()
|
||||
.html(
|
||||
_.map(filteredCodes, code => {
|
||||
filteredCodes.map(code => {
|
||||
const hasDiversity = isSkinTonableEmoji(code);
|
||||
const diversity = hasDiversity ? "diversity" : "";
|
||||
const scaledCode = this._codeWithDiversity(code, hasDiversity);
|
||||
|
|
|
@ -72,14 +72,16 @@ export default Ember.Component.extend(
|
|||
|
||||
if (notices.length > 0) {
|
||||
buffer.push(
|
||||
_.map(notices, n => {
|
||||
var html = `<div class='row'><div class='alert alert-info ${
|
||||
n[1]
|
||||
}'>`;
|
||||
if (n[2]) html += n[2];
|
||||
html += `${n[0]}</div></div>`;
|
||||
return html;
|
||||
}).join("")
|
||||
notices
|
||||
.map(n => {
|
||||
var html = `<div class='row'><div class='alert alert-info ${
|
||||
n[1]
|
||||
}'>`;
|
||||
if (n[2]) html += n[2];
|
||||
html += `${n[0]}</div></div>`;
|
||||
return html;
|
||||
})
|
||||
.join("")
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -119,7 +119,7 @@ Site.reopenClass(Singleton, {
|
|||
let subcatMap = {};
|
||||
|
||||
result.categoriesById = {};
|
||||
result.categories = _.map(result.categories, c => {
|
||||
result.categories = result.categories.map(c => {
|
||||
if (c.parent_category_id) {
|
||||
subcatMap[c.parent_category_id] =
|
||||
subcatMap[c.parent_category_id] || [];
|
||||
|
@ -158,7 +158,7 @@ Site.reopenClass(Singleton, {
|
|||
|
||||
if (result.post_action_types) {
|
||||
result.postActionByIdLookup = Em.Object.create();
|
||||
result.post_action_types = _.map(result.post_action_types, p => {
|
||||
result.post_action_types = result.post_action_types.map(p => {
|
||||
const actionType = PostActionType.create(p);
|
||||
result.postActionByIdLookup.set("action" + p.id, actionType);
|
||||
return actionType;
|
||||
|
@ -167,7 +167,7 @@ Site.reopenClass(Singleton, {
|
|||
|
||||
if (result.topic_flag_types) {
|
||||
result.topicFlagByIdLookup = Em.Object.create();
|
||||
result.topic_flag_types = _.map(result.topic_flag_types, p => {
|
||||
result.topic_flag_types = result.topic_flag_types.map(p => {
|
||||
const actionType = PostActionType.create(p);
|
||||
result.topicFlagByIdLookup.set("action" + p.id, actionType);
|
||||
return actionType;
|
||||
|
@ -175,7 +175,7 @@ Site.reopenClass(Singleton, {
|
|||
}
|
||||
|
||||
if (result.archetypes) {
|
||||
result.archetypes = _.map(result.archetypes, a => {
|
||||
result.archetypes = result.archetypes.map(a => {
|
||||
a.site = result;
|
||||
return Archetype.create(a);
|
||||
});
|
||||
|
|
|
@ -469,7 +469,7 @@ const User = RestModel.extend({
|
|||
}).then(json => {
|
||||
if (!Em.isEmpty(json.user.stats)) {
|
||||
json.user.stats = Discourse.User.groupStats(
|
||||
_.map(json.user.stats, s => {
|
||||
json.user.stats.map(s => {
|
||||
if (s.count) s.count = parseInt(s.count, 10);
|
||||
return UserActionStat.create(s);
|
||||
})
|
||||
|
|
|
@ -33,7 +33,7 @@ function _loadCachedShortUrls($images) {
|
|||
}
|
||||
|
||||
function _loadShortUrls($images, ajax) {
|
||||
const urls = _.map($images, img => $(img).data("orig-src"));
|
||||
const urls = $images.map(img => $(img).data("orig-src"));
|
||||
lookupUncachedUploadUrls(urls, ajax).then(() =>
|
||||
_loadCachedShortUrls($images)
|
||||
);
|
||||
|
|
|
@ -71,7 +71,7 @@ export default Ember.Component.extend({
|
|||
|
||||
@computed()
|
||||
allTimezones() {
|
||||
return _.map(moment.tz.names(), z => z);
|
||||
return moment.tz.names();
|
||||
},
|
||||
|
||||
@observes(
|
||||
|
|
|
@ -5,7 +5,7 @@ QUnit.module("Report");
|
|||
function reportWithData(data) {
|
||||
return Report.create({
|
||||
type: "topics",
|
||||
data: _.map(data, (val, index) => {
|
||||
data: data.map((val, index) => {
|
||||
return {
|
||||
x: moment()
|
||||
.subtract(index, "days")
|
||||
|
|
Loading…
Reference in New Issue