Comments (6)
Hi,
Same issue when I used with cucumber-js tests :(
from data-store.
Hi,
Same issue when I used with cucumber-js tests :(
@julien235
Seems like it has to do with multiple declared stores. If you have multiple files you can try passing the store through functions.
from data-store.
Do either of you have any code to demonstrate the issue you're having?
from data-store.
from data-store.
i believe it keeps a working version in memory, it definitely doesn't update the values based on changes to the file, until you restart the software and reload it. if you are including them both in the same application, i would establish it once in the main file and make the instance available globally so you can access it from multiple files. if you cant do that (maybe its across multiple apps), you probably want a database instead.
from data-store.
I'm using a single file but creating multiple store instances to limit the scope of individual classes. Faced with the fact that deleted data was returned when trying to write to a file. I also use a wrapper for store.
This is a bad solution, but this helped:
const config = require('../config.js')
export class DB {
private get db() {
const db: any = require('data-store')({ path: process.cwd() + config.dbPath })
if (this.prefix && !db.has(this.prefix)) {
db.set(this.prefix, {})
}
return db
}
constructor(private prefix?: string) {}
get(key?: string): any {
if (this.prefix && key) {
return this.db.get(`${this.prefix}.${key}`)
}
if (this.prefix && !key) {
return this.db.get(this.prefix)
}
if (key) {
return this.db.get(key)
}
return undefined
}
//other methods...
}
from data-store.
Related Issues (20)
- store.get() without parameters doesn't work HOT 5
- TypeError: Class constructor Store cannot be invoked without 'new' HOT 2
- store.set() key with dot dymbol HOT 1
- Inconsistency of undefined HOT 1
- Delete object inside array HOT 1
- error while using del method in typescript HOT 1
- Does store.load() delete the data?
- store.clear into store.set into store.load deletes whole store HOT 2
- Create optional lock file for use of the data-store by external process HOT 7
- Release Notes ? HOT 1
- Retrieving data-store HOT 1
- deprecated isObject HOT 1
- decreated isObject HOT 1
- NPM owner HOT 3
- v4.1.0 has not been published to npm HOT 6
- How can stored values be updated? HOT 1
- Data-store wont save anything. HOT 2
- How to pass a variable as key
- Depends on 2 high severity vulnerabilities
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from data-store.