Skip to content

deleting value return null insteed of undefined #7

@thib3113

Description

@thib3113

A non existing value return "undefined", where deleting a value just replace the value by "null", so getting the deleted value return null .

I've done some research in the code, and in fact, I doesn't understand this line :
https://github.com/cayasso/cacheman-memory/blob/master/src/index.js#L39
if (data.expire !== -1 && data.expire < Date.now()) {

To remove a value, you set the data.expire to -1, so why checking if data.expire !== -1 to delete it ?
I think, this line need to be :
if (data.expire === -1 || data.expire < Date.now()) {

Or directly
if (data.expire < Date.now()) {

Else, the deleted value (replaced by null), is returned ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions