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

p-odm

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-odm - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

34

lib/model.js

@@ -37,2 +37,7 @@ 'use strict';

// fast exit
if (dbdata === undefined || dbdata === null) {
return undefined;
}
if (typeof(dbdata) === 'object') {

@@ -769,17 +774,26 @@ for (key in dbdata) {

if (value !== undefined && value !== null) {
if (value instanceof ObjectID) {
return value;
}
// if string try to convert
if (typeof value === 'string' && value.length === 24 && objectIdRegExp.test(value)) {
return ObjectID.createFromHexString(value);
}
// value exists, now it can be either an _id or and object with an _id
if (value._id !== undefined) {
if (value._id !== null) {
if (!(value._id instanceof ObjectID)) {
// TODO: this is wrong we should use the callbacks
throw new Error(key + ' must be a ObjectId Object');
if (value.hasOwnProperty('_id')) {
if (value._id !== undefined) {
if (value._id === null) {
return null;
}
if (value._id instanceof ObjectID) {
return value._id;
}
}
return value._id;
}
if (!(value instanceof ObjectID)) {
// TODO: this is wrong we should use the callbacks
throw new Error(key + ' must be a ObjectId Object');
}
// TODO: this is wrong we should use the callbacks
throw new Error(key + ' must be a ObjectId Object');
}

@@ -786,0 +800,0 @@ return value;

@@ -8,3 +8,3 @@ {

],
"version": "0.0.6",
"version": "0.0.7",
"engines": {

@@ -11,0 +11,0 @@ "node": ">=0.4.12"

Sorry, the diff of this file is not supported yet

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