From 8d18125cae6f96a09ddbe197505c8686142f534c Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 9 Dec 2018 13:13:00 +0900 Subject: [PATCH] Eliminate if-statement (#3556) --- src/chart/index.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/chart/index.ts b/src/chart/index.ts index b59ad7602..aff30bf0f 100644 --- a/src/chart/index.ts +++ b/src/chart/index.ts @@ -61,11 +61,7 @@ export default abstract class Chart { constructor(name: string, grouped = false) { this.collection = db.get>(`chart.${name}`); - if (grouped) { - this.collection.createIndex({ span: -1, date: -1, group: -1 }, { unique: true }); - } else { - this.collection.createIndex({ span: -1, date: -1 }, { unique: true }); - } + this.collection.createIndex({ span: -1, date: -1, group: grouped ? -1 : undefined }, { unique: true }); } @autobind