Skip to content

Commit 869c101

Browse files
committed
Inline default resource structure to work around issue
See here for more information: rmariuzzo#5
1 parent 20d5b48 commit 869c101

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

index.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,11 +148,6 @@ function lowdbApi(file, options = {}) {
148148
* @private
149149
*/
150150

151-
const defaultResource = {
152-
data: [],
153-
metadata: {}
154-
}
155-
156151
function all(db, key) {
157152
return db.get(`${key}.data`, []).value()
158153
}
@@ -163,7 +158,7 @@ function get(db, key, id) {
163158

164159
function insert(db, key, data) {
165160
// Ensure a resource entry exist for the given key.
166-
db.defaults({ [key]: defaultResource }).write()
161+
db.defaults({ [key]: { data: [], metadata: {} } }).write()
167162

168163
// Generate the next id.
169164
if (typeof data.id === 'undefined') {

0 commit comments

Comments
 (0)