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

objectid

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

objectid - npm Package Compare versions

Comparing version 3.2.0 to 3.2.1

12

index.js

@@ -1,4 +0,2 @@

var inherits = require('util').inherits
var ObjectId = require('bson').ObjectId
var toString = require('to-string')

@@ -11,3 +9,3 @@ ObjectId.prototype.equals = function (oidB) {

var isValid = function (alleged) {
return (!!alleged && objIdPattern.test(toString(alleged)))
return (Boolean(alleged) && !Array.isArray(alleged) && objIdPattern.test(String(alleged)))
}

@@ -24,4 +22,4 @@

if (oidA === oidB) { return true; }
if (!oidA || !oidB) { return false }
return (oidA.toString() === oidB.toString())
if (!isValid(oidA) || !isValid(oidB)) { return false }
return (String(oidA) === String(oidB))
return false;

@@ -47,3 +45,3 @@ }

id = toString(id)
id = String(id)

@@ -63,2 +61,2 @@ if (isValid(id)) {

module.exports.equals = equals;
module.exports.isValid = isValid;
module.exports.isValid = isValid;
{
"name": "objectid",
"version": "3.2.0",
"version": "3.2.1",
"description": "mongodb objectid utilities",

@@ -24,13 +24,11 @@ "main": "index.js",

"devDependencies": {
"mongodb": "~1.2.12",
"bson": "~0.1.8",
"chai": "~1.5.0",
"chai-interface": "~1.1.0",
"mocha": "~1.8.2",
"chai-interface": "~1.1.0",
"bson": "~0.1.8"
"mongodb": "~1.2.12"
},
"dependencies": {
"mongodb": "~1.3.3",
"bson": "~0.1.8",
"to-string": "~0.2.0"
"bson": "^0.1.9"
}
}

@@ -132,2 +132,6 @@ var chai = require('chai')

it('false for 1-element array of ObjectId', function () {
ObjectId.isValid([ObjectId()]).should.equal(false)
})
})

@@ -146,4 +150,5 @@

})
it('returns false otherwise', function () {
it('returns false if A or B are not ObjectIds', function () {
ObjectId.equals('sdfsdfsdfsdf', testOid).should.equal(false)
ObjectId.equals('511083bb08ce6b1b00000003', ['511083bb08ce6b1b00000003']).should.equal(false)
})

@@ -150,0 +155,0 @@ it('is also on ObjectId.prototype', function () {

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