Skip to content

Commit

Permalink
BREAKING CHANGE: remove array.prototype.flat polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Sep 3, 2024
1 parent a732fd0 commit b7ae4a8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 2 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const flat = require('array.prototype.flat');
const mpath = require('mpath');

const documentParentsMap = new WeakMap();
Expand Down Expand Up @@ -148,7 +147,7 @@ function applyVirtualsToChildren(doc, schema, res, virtuals, parent) {
continue;
}
const _doc = mpath.get(_path, res);
if (_doc == null || (Array.isArray(_doc) && flat(_doc, Infinity).length === 0)) {
if (_doc == null || (Array.isArray(_doc) && _doc.flat(Infinity).length === 0)) {
continue;
}

Expand Down Expand Up @@ -235,4 +234,4 @@ function isPopulateVirtual(virtualType) {
}

module.exports.defaults = module.exports;
module.exports.mongooseLeanVirtuals = module.exports;
module.exports.mongooseLeanVirtuals = module.exports;
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"mongodb"
],
"dependencies": {
"array.prototype.flat": "1.2.3",
"mpath": "^0.8.4"
},
"devDependencies": {
Expand Down

0 comments on commit b7ae4a8

Please sign in to comment.