Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongoose-lean-virtuals

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongoose-lean-virtuals - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

4

CHANGELOG.md

@@ -0,1 +1,5 @@

0.7.4 / 2020-11-20
==================
* fix: support nested virtuals #43 [rdougan](https://github.com/rdougan)
0.7.3 / 2020-11-12

@@ -2,0 +6,0 @@ ==================

@@ -79,3 +79,3 @@ 'use strict';

applyVirtualsToChildren(this, schema, res, virtualsForChildren);
applyVirtualsToChildren(this, schema, res, virtualsForChildren, parent);
return applyVirtualsToResult(schema, res, toApply, parent);

@@ -102,4 +102,5 @@ }

function applyVirtualsToChildren(doc, schema, res, virtuals) {
function applyVirtualsToChildren(doc, schema, res, virtuals, parent) {
const len = schema.childSchemas.length;
let attachedVirtuals = false;
for (let i = 0; i < len; ++i) {

@@ -128,4 +129,13 @@ const _path = schema.childSchemas[i].model.path;

attachVirtuals.call(doc, _schema, _doc, virtualsForChild, res);
if (virtualsForChild.length > 0) {
attachVirtuals.call(doc, _schema, _doc, virtualsForChild, res);
attachedVirtuals = true;
}
}
if (virtuals && virtuals.length && !attachedVirtuals) {
attachVirtualsToDoc(schema, res, virtuals.map(function(virtual) {
return virtual.join('.');
}), parent);
}
}

@@ -132,0 +142,0 @@

2

package.json
{
"name": "mongoose-lean-virtuals",
"version": "0.7.3",
"version": "0.7.4",
"description": "Attach virtuals to the results of mongoose queries when using `.lean()`",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc