Skip to content

Commit

Permalink
remove generated id from output
Browse files Browse the repository at this point in the history
  • Loading branch information
jonian committed Feb 2, 2024
1 parent f4741fa commit b58036b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export class Database extends Hookable {
this.json = new Json(options.json)
this.json5 = new Json5(options.json5)

this.omitKeys = ['_id']
this.parsers = options.extendParser || {}
this.extensions = EXTENSIONS.concat(Object.keys(this.parsers))
this.options = options
Expand Down Expand Up @@ -71,7 +72,8 @@ export class Database extends Hookable {

const path = join(dir, filename)
const data = await this.db.find({}).toArray()
const json = JSON.stringify(data)
const omit = (key, val) => this.omitKeys.includes(key) ? undefined : val
const json = JSON.stringify(data, omit)

await fs.mkdir(dir, { recursive: true })
await fs.writeFile(path, json, 'utf-8')
Expand Down

0 comments on commit b58036b

Please sign in to comment.