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);
请教一下,这一大段,都是复制粘贴。能用更简洁的代码一次搞定吗?
I don’t know if it counts as the abbreviation in your mind. I think from the perspective of repetition, extract the different parts and make an array, and abstract the same parts, as follows:
I don’t know how to use your next code? If the logic code behind is easy to change, you can change it to: