Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit ca700cc

Browse files
committed
fix(repo): init does not break if no opts are passed. Fixes #349
1 parent 7dcff81 commit ca700cc

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/core/ipfs/init.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ const Importer = require('ipfs-unixfs-engine').importer
1212

1313
module.exports = function init (self) {
1414
return (opts, callback) => {
15-
opts = opts || {}
15+
if (typeof opts === 'function') {
16+
callback = opts
17+
opts = {}
18+
}
19+
1620
opts.emptyRepo = opts.emptyRepo || false
1721
opts.bits = opts.bits || 2048
1822

1923
// Pre-set config values.
20-
var config = JSON.parse(fs.readFileSync(path.join(__dirname, '../../init-files/default-config.json')).toString())
24+
const config = JSON.parse(fs.readFileSync(path.join(__dirname, '../../init-files/default-config.json')).toString())
2125

2226
// Verify repo does not yet exist.
2327
self._repo.exists((err, exists) => {

0 commit comments

Comments
 (0)