I've been enjoying using LevelUP quite a bit, in fact I'm writing my own wrapper around it to provide a simpler interface. I wanted to create methods for .keys(), .values(), and .entries(). I was converting the streams to Promises, but I've encountered an odd problem. The output from createValueStream() only contains 3 of my 11 entries.
Output from .values():
[ false, true, { value: false } ]
Output from .entries():
[
{ key: 'bool-test-false', value: false },
{ key: 'bool-test-true', value: true },
{ key: 'not-exist', value: { value: false } },
{ key: 'null-test', value: null },
{ key: 'number-test-neg', value: -1 },
{ key: 'number-test-one', value: 1 },
{ key: 'number-test-zero', value: 0 },
{ key: 'object-test', value: { bool: true, str: 'Hello!', emptyStr: '', subObject: [Object] } },
{ key: 'object-test-empty', value: {} },
{ key: 'string-test', value: 'Hello' },
{ key: 'string-test-empty', value: '' }
]
.keys() and .entries() both return proper values, and I can work around this by getting the entries and filtering to only the values, but that's not as efficient. Just a note, .createReadStream({ keys: false, values: true}) yields the same problem. Any ideas why this is happening?