New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hadron-document

Package Overview
Dependencies
Maintainers
25
Versions
546
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hadron-document - npm Package Compare versions

Comparing version 2.3.1 to 2.3.2

27

lib/element.js

@@ -8,3 +8,5 @@ 'use strict';

const isEqual = require('lodash.isequal');
const isString = require('lodash.isstring');
const includes = require('lodash.includes');
const { ObjectId } = require('bson');
const Iterator = require('./iterator');

@@ -15,2 +17,4 @@ const ObjectGenerator = require('./object-generator');

const DATE_FORMAT = 'YYYY-MM-DD HH:mm:ss.SSS';
/**

@@ -305,3 +309,3 @@ * The event constant.

return (this.key !== this.currentKey ||
!isEqual(this.value, this.currentValue) ||
!this._valuesEqual() ||
this.type !== this.currentType) &&

@@ -312,2 +316,22 @@ !this.isAdded();

/**
* Check for value equality.
*/
_valuesEqual() {
if (this.currentType === 'Date' && isString(this.currentValue)) {
return isEqual(this.value, new Date(this.currentValue));
} else if (this.currentType === 'ObjectID' && isString(this.currentValue)) {
return this._isObjectIdEqual();
}
return isEqual(this.value, this.currentValue);
}
_isObjectIdEqual() {
try {
return isEqual(this.value, ObjectId.createFromHexString(this.currentValue));
} catch (_) {
return false;
}
}
/**
* Is the element the last in the elements.

@@ -706,1 +730,2 @@ *

module.exports.Events = Events;
module.exports.DATE_FORMAT = DATE_FORMAT;

6

package.json

@@ -7,3 +7,3 @@ {

"homepage": "https://github.com/mongodb-js/hadron-document",
"version": "2.3.1",
"version": "2.3.2",
"repository": {

@@ -27,2 +27,3 @@ "type": "git",

"dependencies": {
"bson": "^0.5.4",
"debug": "^2.2.0",

@@ -35,2 +36,3 @@ "hadron-type-checker": "^2.1.0",

"lodash.isplainobject": "^4.0.4",
"lodash.isstring": "^4.0.1",
"lodash.keys": "^4.0.7",

@@ -40,6 +42,6 @@ "uuid": "^3.0.0"

"devDependencies": {
"bson": "^0.5.4",
"chai": "^3.4.1",
"eslint-config-mongodb-js": "^2.2.0",
"mocha": "^2.3.4",
"moment": "^2.18.1",
"mongodb-js-fmt": "^0.0.3",

@@ -46,0 +48,0 @@ "mongodb-js-precommit": "^0.2.9",

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