Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect implementation of inflate #920

Open
Losses opened this issue Dec 3, 2022 · 0 comments
Open

Incorrect implementation of inflate #920

Losses opened this issue Dec 3, 2022 · 0 comments

Comments

@Losses
Copy link

Losses commented Dec 3, 2022

Based on the unit test:

inflate: function(src) {
var dest = {};
dest.$loki = src.$loki;
dest.meta = src.meta;
dest.onlyInflater = true;
return dest;
}

Loki should read the returned value of inflater as the returned data, but the implementation didn't do this:

LokiJS/src/lokijs.js

Lines 1741 to 1745 in 25b9a33

return function (data) {
var collObj = new (collOptions.proto)();
inflater(data, collObj);
return collObj;
};

The code should be:

          return function (data) {
            var collObj = new (collOptions.proto)();
            return inflater(data, collObj) ?? collObj;
          };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant