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

hadron-type-checker

Package Overview
Dependencies
Maintainers
28
Versions
497
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hadron-type-checker - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

4

package.json

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

"homepage": "https://github.com/mongodb-js/hadron-type-checker",
"version": "5.0.0",
"version": "5.1.0",
"repository": {

@@ -29,5 +29,5 @@ "type": "git",

"eslint-config-mongodb-js": "^5.0.3",
"mocha": "^7.0.1",
"mocha": "^8.0.1",
"mongodb-js-precommit": "^2.1.0"
}
}

@@ -162,7 +162,20 @@ const {

}
const number = toNumber(object);
if (number >= BSON_INT64_MIN && number <= BSON_INT64_MAX) {
return Long.fromNumber(number);
// when casting from int32 object(this will have object.value) or literal
// (it will a typeof number) we can safely create object fromNumber, as it
// will not be greater than JS's max value
if (object.value || typeof object === 'number') {
return Long.fromNumber(number);
} else if (typeof object === 'object') {
// to make sure we are still displaying Very Large numbers properly, convert
// the current 'object' to a string
return Long.fromString(object.toString());
}
return Long.fromString(object);
}
throw new Error(`Value ${number} is outside the valid Int64 range`);
throw new Error(`Value ${object.toString()} is outside the valid Int64 range`);
};

@@ -186,3 +199,3 @@

if (hasIn(object, BSON_TYPE) && includes(NUMBER_TYPES, object._bsontype)) {
object = object._bsontype === LONG ? object.toNumber() : object.valueOf();
object = object._bsontype === LONG ? object.toString() : object.valueOf();
}

@@ -189,0 +202,0 @@ return Decimal128.fromString('' + object);

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