Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

createValueStream not containing all values #418

@foxfirecodes

Description

@foxfirecodes

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions