REFACTOR: Remove _.compact

This commit is contained in:
Robin Ward 2020-09-01 16:47:22 -04:00
parent 2d56663fc4
commit 0da953b40e
3 changed files with 6 additions and 9 deletions

View File

@ -195,15 +195,12 @@ export default DiscourseRoute.extend(FilterModeMixin, {
// Pre-fill the tags input field
if (controller.get("model.id")) {
const composerModel = this.controllerFor("composer").get("model");
composerModel.set(
"tags",
_.compact(
_.flatten([
controller.get("model.id"),
controller.get("additionalTags")
])
)
[
controller.get("model.id"),
...controller.get("additionalTags")
].filter(Boolean)
);
}
});

View File

@ -253,7 +253,7 @@ export function emojiSearch(term, options) {
}
export function isSkinTonableEmoji(term) {
const match = _.compact(term.split(":"))[0];
const match = term.split(":").filter(Boolean)[0];
if (match) {
return tonableEmojis.indexOf(match) !== -1;
}

View File

@ -10,7 +10,7 @@ export function lookupCachedUploadUrl(shortUrl) {
const MISSING = "missing";
export function lookupUncachedUploadUrls(urls, ajax) {
urls = _.compact(urls);
urls = urls.filter(Boolean);
if (urls.length === 0) {
return;
}