options.filename = dbPath+'picker';
pickerDB = new Datastore(options);
options.filename = dbPath+'data';
dataDB = new Datastore(options);
options.filename = dbPath+'web';
webDB = new Datastore(options);
options.filename = dbPath+'url';
urlDB = new Datastore(options);
options.filename = dbPath+'attach';
attachDB = new Datastore(options);
options.filename = dbPath+'cacheUrl';
cacheUrlDB = new Datastore(options);
options.filename = dbPath+'cache';
cacheDB = new Datastore(options);
options.filename = dbPath+'cron';
cronDB = new Datastore(options);
options.filename = dbPath+'log';
logDB = new Datastore(options);
options.filename = dbPath+'cronLog';
cronLogDB = new Datastore(options);
请教一下,这一大段,都是复制粘贴。能用更简洁的代码一次搞定吗?
頭の中で省略といえるのかわかりませんが、繰り返しの観点から、異なる部分を抽出して配列し、同じ部分を抽象化すると次のようになります。
次のコードの使用方法がわかりません。背後にあるロジック コードが簡単に変更できる場合は、次のように変更できます。