Skip to content

deleting value return null insteed of undefined #7

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 ...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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