Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Lowdb from 'lowdb'
// import FileSync from 'lowdb/adapters/FileSync'
import Memory from 'lowdb/adapters/Memory'
import mkdirp from 'mkdirp'
import { resolve } from 'path'
mkdirp(resolve(__dirname, '../../live'))
// export const db = new Lowdb(new FileSync(resolve(__dirname, '../../live/db.json')))
export const db = new Lowdb(new Memory())
// Seed an empty DB
db.defaults({
messages: [
{
id: 'a',
text: 'Message 1',
},
{
id: 'b',
text: 'Message 2',
},
{
id: 'c',
text: 'Message 3',
},
function setupDB() {
const db = low(new MemoryAdapter());
db.defaults({ posts: [], authors: [] }).write();
times(2, () =>
db
.get("authors")
.push({
id: casual.uuid,
name: casual.first_name + " " + casual.last_name
})
.write()
);
db.get("authors")
.value()
.forEach(({ id }) => {
export default function setupDB() {
const db = low(new MemoryAdapter());
db.defaults({ posts: [], authors: [] }).write();
times(2, () =>
db
.get("authors")
.push({
id: casual.uuid,
name: casual.first_name + " " + casual.last_name
})
.write()
);
db
.get("authors")
.value()
const makeDefaults = () => {
const db = low(new Memory());
const app = make(db);
const request = supertest(app);
return { db, app, request };
};
private initDbSync(filePath: string): lowdb.LowdbSync {
let adapter: lowdb.AdapterSync;
if (filePath) {
const parentDir = path.dirname(filePath);
mkdirp.sync(parentDir);
adapter = new FileSync(filePath);
} else {
adapter = new Memory('');
}
return lowdb(adapter);
}
}
constructor({defaultData, hooks}: {defaultData?: any, hooks?: Hooks}) {
const adapter = new Memory();
this.hooks = hooks || {};
this.db = low(adapter);
if (defaultData) {
this.db.defaults(defaultData).write();
}
}
'use babel';
import low from 'lowdb';
import fs from 'fs';
import Memory from 'lowdb/adapters/Memory';
const adapter = new Memory();
const db = low(adapter);
db
.defaults({
commitMessages: {},
blames: [],
fileCommits: [],
rootPaths: {},
startDates: {},
repoMetadata: {},
pullRequests: [],
pullRequestsCommitsPivot: {},
issues: [],
})
.write();
'use babel';
import low from 'lowdb';
import fs from 'fs';
import Memory from 'lowdb/adapters/Memory';
const adapter = new Memory();
const db = low(adapter);
db
.defaults({
commitMessages: {},
blames: [],
fileCommits: [],
rootPaths: {},
startDates: {},
repoMetadata: {},
pullRequests: [],
pullRequestsCommitsPivot: {},
githubIssues: [],
jiraIssues: [],
})
.write();
window.layerCacheDump = function (path = __dirname) {