LokiJS icon indicating copy to clipboard operation
LokiJS copied to clipboard

Incorrect implementation of `inflate`

Open Losses opened this issue 3 years ago • 0 comments

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;
          };

Losses avatar Dec 03 '22 15:12 Losses