techfort / LokiJS

javascript embeddable / in-memory database
http:/techfort.github.io/LokiJS
MIT License
6.71k stars 478 forks source link

Incorrect implementation of `inflate` #920

Open Losses opened 1 year ago

Losses commented 1 year ago

Based on the unit test:

https://github.com/techfort/LokiJS/blob/25b9a33d57509717d43b4da06d92064f2b7a6c95/spec/generic/immutable.spec.js#L1051-L1059

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

https://github.com/techfort/LokiJS/blob/25b9a33d57509717d43b4da06d92064f2b7a6c95/src/lokijs.js#L1741-L1745

The code should be:

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