Skip to content

Commit

Permalink
Linting happy
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Apr 8, 2016
1 parent 1562a3f commit f505d2c
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

const stores = require('./stores')

exports = module.exports = Repo

function Repo (repoPath, options) {
if (!options) { throw new Error('missing options param') }
if (!options.stores) { throw new Error('missing options.stores param') }

// If options.stores is an abstract-blob-store instead of a map, use it for
// all stores.
if (options.stores.prototype && options.stores.prototype.createWriteSteam) {
var store = options.stores
const store = options.stores
options.stores = {
keys: store,
config: store,
Expand Down Expand Up @@ -70,3 +68,5 @@ function Repo (repoPath, options) {
// .logs
// .setUp(repoPath, options.stores.logs, this.locks)
}

exports = module.exports = Repo
4 changes: 2 additions & 2 deletions src/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ exports.setUp = (basePath, blobStore, locks) => {
let result
try {
result = JSON.parse(config.toString())
} catch (err) {
return callback(err)
} catch (error) {
return callback(error)
}
callback(null, result)
}))
Expand Down
16 changes: 8 additions & 8 deletions src/stores/datastore.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ const PREFIX_LENGTH = 8

exports = module.exports

function multihashToPath (multihash) {
const filename = multihash.toString('hex') + '.data'
const folder = filename.slice(0, PREFIX_LENGTH)
const path = folder + '/' + filename

return path
}

exports.setUp = (basePath, blobStore, locks) => {
const store = blobStore(basePath + '/blocks')

Expand All @@ -27,11 +35,3 @@ exports.setUp = (basePath, blobStore, locks) => {
}
}
}

function multihashToPath (multihash) {
const filename = multihash.toString('hex') + '.data'
const folder = filename.slice(0, PREFIX_LENGTH)
const path = folder + '/' + filename

return path
}
18 changes: 9 additions & 9 deletions src/stores/locks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ exports.setUp = (basePath, blobStore) => {

return {
lock: function (cb) {
store.exists(lockFile, doesExist)
function createLock () {
store
.createWriteStream(lockFile)
.on('finish', () => {
cb()
})
.end()
}

function doesExist (err, exists) {
if (err) {
Expand All @@ -24,14 +31,7 @@ exports.setUp = (basePath, blobStore) => {
createLock()
}

function createLock () {
store
.createWriteStream(lockFile)
.on('finish', () => {
cb()
})
.end()
}
store.exists(lockFile, doesExist)
},
unlock: (cb) => {
store.remove(lockFile, (err) => {
Expand Down
2 changes: 1 addition & 1 deletion test/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ idb.deleteDatabase('ipfs/blocks')
// TODO use arrow funtions again when https://github.com/webpack/webpack/issues/1944 is fixed
describe('IPFS Repo Tests on the Browser', function () {
before(function (done) {
var repoData = []
const repoData = []
repoContext.keys().forEach(function (key) {
repoData.push({
key: key.replace('./', ''),
Expand Down

0 comments on commit f505d2c

Please sign in to comment.