huan / memory-card

Memory Card is an Easy to Use Key/Value Store Implements ES6 Map with Async API in Distribution Scenarios.
https://paka.dev/npm/memory-card
Apache License 2.0
5 stars 3 forks source link

toJson feature is wanted #34

Open wj-Mcat opened 3 years ago

wj-Mcat commented 3 years ago

When we load the memory card, and want to get json data from card, toJson method should be supported.

huan commented 3 years ago

Could you please provide a use case in detail for example to demonstrate this feature request, so that I could be able to understand it better?

Thank you very much.

wj-Mcat commented 3 years ago

There is a need:

const memoryCard = new MemoryCard('whatsapp-session-config')
memoryCard.set('key', 'value-string')
memoryCard.set('key-1', 'value-string')
const jsonObj = memoryCard.toJson()
const jsonString = JSON.stringify(jsonObj)

I'm not sure if memoryCard already has such a feature method. @huan How do you think about ?

huan commented 3 years ago

Could you please explain that what's the reason that you have to build this json string?

I believe the ES6-like API from our memory-card can fulfill what you need. If not, what is your scenario, and why can't you use the ES6-like API?

Please explain them in detail, so that I can explain the design of the memory-card to you: it's a distributed key-value storage driver.