Skip to content

Commit f505d2c

Browse files
Linting happy
1 parent 1562a3f commit f505d2c

File tree

5 files changed

+23
-23
lines changed

5 files changed

+23
-23
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22

33
const stores = require('./stores')
44

5-
exports = module.exports = Repo
6-
75
function Repo (repoPath, options) {
86
if (!options) { throw new Error('missing options param') }
97
if (!options.stores) { throw new Error('missing options.stores param') }
108

119
// If options.stores is an abstract-blob-store instead of a map, use it for
1210
// all stores.
1311
if (options.stores.prototype && options.stores.prototype.createWriteSteam) {
14-
var store = options.stores
12+
const store = options.stores
1513
options.stores = {
1614
keys: store,
1715
config: store,
@@ -70,3 +68,5 @@ function Repo (repoPath, options) {
7068
// .logs
7169
// .setUp(repoPath, options.stores.logs, this.locks)
7270
}
71+
72+
exports = module.exports = Repo

src/stores/config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ exports.setUp = (basePath, blobStore, locks) => {
1717
let result
1818
try {
1919
result = JSON.parse(config.toString())
20-
} catch (err) {
21-
return callback(err)
20+
} catch (error) {
21+
return callback(error)
2222
}
2323
callback(null, result)
2424
}))

src/stores/datastore.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ const PREFIX_LENGTH = 8
44

55
exports = module.exports
66

7+
function multihashToPath (multihash) {
8+
const filename = multihash.toString('hex') + '.data'
9+
const folder = filename.slice(0, PREFIX_LENGTH)
10+
const path = folder + '/' + filename
11+
12+
return path
13+
}
14+
715
exports.setUp = (basePath, blobStore, locks) => {
816
const store = blobStore(basePath + '/blocks')
917

@@ -27,11 +35,3 @@ exports.setUp = (basePath, blobStore, locks) => {
2735
}
2836
}
2937
}
30-
31-
function multihashToPath (multihash) {
32-
const filename = multihash.toString('hex') + '.data'
33-
const folder = filename.slice(0, PREFIX_LENGTH)
34-
const path = folder + '/' + filename
35-
36-
return path
37-
}

src/stores/locks.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@ exports.setUp = (basePath, blobStore) => {
88

99
return {
1010
lock: function (cb) {
11-
store.exists(lockFile, doesExist)
11+
function createLock () {
12+
store
13+
.createWriteStream(lockFile)
14+
.on('finish', () => {
15+
cb()
16+
})
17+
.end()
18+
}
1219

1320
function doesExist (err, exists) {
1421
if (err) {
@@ -24,14 +31,7 @@ exports.setUp = (basePath, blobStore) => {
2431
createLock()
2532
}
2633

27-
function createLock () {
28-
store
29-
.createWriteStream(lockFile)
30-
.on('finish', () => {
31-
cb()
32-
})
33-
.end()
34-
}
34+
store.exists(lockFile, doesExist)
3535
},
3636
unlock: (cb) => {
3737
store.remove(lockFile, (err) => {

test/browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ idb.deleteDatabase('ipfs/blocks')
2121
// TODO use arrow funtions again when https://github.com/webpack/webpack/issues/1944 is fixed
2222
describe('IPFS Repo Tests on the Browser', function () {
2323
before(function (done) {
24-
var repoData = []
24+
const repoData = []
2525
repoContext.keys().forEach(function (key) {
2626
repoData.push({
2727
key: key.replace('./', ''),

0 commit comments

Comments
 (0)