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.25 to 0.0.26

19

js/src/XMongoModel.js

@@ -139,7 +139,20 @@ "use strict";

* Check if id is a valid id
* @param objectId
* @param id
* @return {boolean}
*/
static isValidId(objectId) {
return mongodb_1.ObjectID.isValid(objectId);
static isValidId(id) {
const isMongoID = mongodb_1.ObjectID.isValid(id);
/**
* referring to this StackOverflow post
* https://stackoverflow.com/questions/13850819/can-i-determine-if-a-string-is-a-mongodb-objectid
*
* ObjectID.isValid returns true on any 12 length string
*
* So converting to objectID and checking if the string value matches the original value
* makes the check strict
*/
if (isMongoID && typeof id === 'string') {
return (new mongodb_1.ObjectID(id)).toString() === id;
}
return isMongoID;
}

@@ -146,0 +159,0 @@ /**

2

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

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

@@ -184,7 +184,22 @@ import ObjectCollection = require('object-collection');

* Check if id is a valid id
* @param objectId
* @param id
* @return {boolean}
*/
static isValidId(objectId: any): boolean {
return ObjectID.isValid(objectId)
static isValidId(id: any): boolean {
const isMongoID = ObjectID.isValid(id);
/**
* referring to this StackOverflow post
* https://stackoverflow.com/questions/13850819/can-i-determine-if-a-string-is-a-mongodb-objectid
*
* ObjectID.isValid returns true on any 12 length string
*
* So converting to objectID and checking if the string value matches the original value
* makes the check strict
*/
if (isMongoID && typeof id === 'string') {
return (new ObjectID(id)).toString() === id;
}
return isMongoID;
}

@@ -191,0 +206,0 @@

@@ -99,6 +99,6 @@ import ObjectCollection = require('object-collection');

* Check if id is a valid id
* @param objectId
* @param id
* @return {boolean}
*/
static isValidId(objectId: any): boolean;
static isValidId(id: any): boolean;
/**

@@ -105,0 +105,0 @@ * Set Original result gotten from db

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