From b7ae4a8c7e83cb4e2980cbac7095777019aaf81c Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Tue, 3 Sep 2024 10:54:41 -0400 Subject: [PATCH] BREAKING CHANGE: remove array.prototype.flat polyfill --- index.js | 5 ++--- package.json | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 4a88143..3f77541 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,5 @@ 'use strict'; -const flat = require('array.prototype.flat'); const mpath = require('mpath'); const documentParentsMap = new WeakMap(); @@ -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; } @@ -235,4 +234,4 @@ function isPopulateVirtual(virtualType) { } module.exports.defaults = module.exports; -module.exports.mongooseLeanVirtuals = module.exports; \ No newline at end of file +module.exports.mongooseLeanVirtuals = module.exports; diff --git a/package.json b/package.json index 8942e18..f798624 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,6 @@ "mongodb" ], "dependencies": { - "array.prototype.flat": "1.2.3", "mpath": "^0.8.4" }, "devDependencies": {