Socket
Socket
Sign inDemoInstall

bson

Package Overview
Dependencies
1
Maintainers
2
Versions
162
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.9 to 0.2.10

26

lib/bson/objectid.js

@@ -34,3 +34,3 @@ /**

// Throw an error if it's not a valid setup
if(!valid){
if(!valid && id != null){
throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");

@@ -50,5 +50,11 @@ } else if(valid && typeof id == 'string' && id.length == 24) {

// Allow usage of ObjectId aswell as ObjectID
// Allow usage of ObjectId as well as ObjectID
var ObjectId = ObjectID;
// Precomputed hex table enables speedy hex string conversion
var hexTable = [];
for (var i = 0; i < 256; i++) {
hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16);
}
/**

@@ -63,12 +69,6 @@ * Return the ObjectID id as a 24 byte hex string representation

var hexString = ''
, number
, value;
var hexString = '';
for (var index = 0, len = this.id.length; index < len; index++) {
value = BinaryParser.toByte(this.id[index]);
number = value <= 15
? '0' + value.toString(16)
: value.toString(16);
hexString = hexString + number;
for (var i = 0; i < this.id.length; i++) {
hexString += hexTable[this.id.charCodeAt(i)];
}

@@ -238,3 +238,5 @@

ObjectID.isValid = function isValid(id) {
if (id != null && 'number' != typeof id && (id.length != 12 && id.length != 24)) {
if(id == null) return false;
if(id != null && 'number' != typeof id && (id.length != 12 && id.length != 24)) {
return false;

@@ -241,0 +243,0 @@ } else {

{ "name" : "bson"
, "description" : "A bson parser for node.js and the browser"
, "keywords" : ["mongodb", "bson", "parser"]
, "version" : "0.2.9"
, "version" : "0.2.10"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"

@@ -6,0 +6,0 @@ , "contributors" : []

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc