diff --git a/src/index.js b/src/index.js index 9c70324..b463d19 100644 --- a/src/index.js +++ b/src/index.js @@ -288,12 +288,12 @@ class FsDatastore { */ query (q) { // glob expects a POSIX path - let prefix = q.prefix || '**' - let pattern = path + const prefix = q.prefix || '**' + const pattern = path .join(this.path, prefix, '*' + this.opts.extension) .split(path.sep) .join('/') - let files = glob.sync(pattern) + const files = glob.sync(pattern) let it if (!q.keysOnly) { it = map(files, async (f) => { diff --git a/test/index.spec.js b/test/index.spec.js index 125adbe..4a98ac7 100644 --- a/test/index.spec.js +++ b/test/index.spec.js @@ -125,7 +125,7 @@ describe('FsDatastore', () => { it('query', async () => { const fs = new FsStore(path.join(__dirname, 'test-repo', 'blocks')) - let res = [] + const res = [] for await (const q of fs.query({})) { res.push(q) } @@ -138,9 +138,9 @@ describe('FsDatastore', () => { const key = new Key('CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY') const expected = fs.readFileSync(path.join(repodir, 'VO', key.toString() + '.data')) const flatfs = await ShardingStore.open(fstore) - let res = await flatfs.get(key) - let queryResult = flatfs.query({}) - let results = [] + const res = await flatfs.get(key) + const queryResult = flatfs.query({}) + const results = [] for await (const result of queryResult) results.push(result) expect(results).to.have.length(23) expect(res).to.be.eql(expected)