Skip to content

Commit

Permalink
Inline default resource structure to work around issue
Browse files Browse the repository at this point in the history
See here for more information: rmariuzzo#5
  • Loading branch information
fschrempf committed Oct 11, 2019
1 parent 20d5b48 commit 869c101
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,6 @@ function lowdbApi(file, options = {}) {
* @private
*/

const defaultResource = {
data: [],
metadata: {}
}

function all(db, key) {
return db.get(`${key}.data`, []).value()
}
Expand All @@ -163,7 +158,7 @@ function get(db, key, id) {

function insert(db, key, data) {
// Ensure a resource entry exist for the given key.
db.defaults({ [key]: defaultResource }).write()
db.defaults({ [key]: { data: [], metadata: {} } }).write()

// Generate the next id.
if (typeof data.id === 'undefined') {
Expand Down

0 comments on commit 869c101

Please sign in to comment.