levelup docs say claim that get(), put(), etc will return a Promise if called without a callback:
https://github.com/Level/levelup#promises
I have the following code:
db.get(gameName).then(JSON.parse).then(
but my then() functions never get called. The code runs without crashing but I get the following message in the console:
get() requires key and callback arguments
Am I missing something? Maybe a dependency? I am willing to wrap get() and put() in my own Promises but it seems silly to rewrite functionality like that if it's already there.
Thanks to Jaromanda X and Greg Hornby for the tips. Indeed,
levelupdoes not include Promises yet. But in the meantime, here's a solution usingpromisify, which is now native to node: