Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Commit 2fbaab0

Browse files
committed
cleanup
1 parent 01008b3 commit 2fbaab0

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

index.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ module.exports = function (archive, opts) {
88

99
var db = toiletdb({name: '/dat.json', fs: archive})
1010
var fileDb = opts.file ? toiletdb(opts.file) : null
11+
var defaults = {
12+
title: '',
13+
description: '',
14+
url: 'dat://' + stringKey(archive.key)
15+
}
1116

1217
var that = {
1318
read: function (cb) {
@@ -34,14 +39,8 @@ module.exports = function (archive, opts) {
3439
create: function (data, cb) {
3540
if (typeof data === 'function') return that.create(null, data)
3641
if (!archive.writable) return cb(new Error('Archive not writable'))
37-
var defaults = xtend({
38-
title: '', // TODO path.basename(dir),
39-
name: '',
40-
description: ''
41-
}, data, {
42-
url: 'dat://' + stringKey(archive.key) // force the key as default
43-
})
44-
that.write(defaults, cb)
42+
data = xtend(defaults, data)
43+
that.write(data, cb)
4544
}
4645
}
4746

0 commit comments

Comments
 (0)