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

xpress-mongo

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xpress-mongo - npm Package Compare versions

Comparing version 0.0.10 to 0.0.11

2

package.json
{
"name": "xpress-mongo",
"version": "0.0.10",
"version": "0.0.11",
"description": "Light Weight ODM for mongoDb",

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

@@ -197,2 +197,6 @@ const {ObjectID} = require('mongodb');

/**
* Get id of current model instance
* @returns {*|null}
*/
XMongoModel.prototype.id = function () {

@@ -202,3 +206,32 @@ return (this.data && this.data['_id']) || null

/**
* Compare model id with a string or ObjectId type variable.
* @param to
* @param key
* @returns {boolean}
*/
XMongoModel.prototype.idEqualTo = function (to, key = "_id") {
/**
* Get Value to be compared with
* @type {ObjectID|string}
*/
let compareWith = this.get(key, undefined);
// Return false of to || compareWith is false, undefined or null
if (!to || !compareWith) return false;
/**
* If to || compareWith is typeof objectID, we run toString() get the string value.
*/
if (ObjectID.isValid(to)) to = to.toString();
if (ObjectID.isValid(compareWith)) compareWith = compareWith.toString();
// Compare Strings
return to === compareWith;
};
/**
* See changes made so far.

@@ -426,3 +459,2 @@ * @return {*}

/**

@@ -429,0 +461,0 @@ * Find many in collection

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