bson 4.7.0 → 4.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4474,22 +4474,17 @@ var BSON = (function (exports) {
4474
4474
  if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
4475
4475
  return this.value;
4476
4476
  }
4477
- // NOTE: JavaScript has +0 and -0, apparently to model limit calculations. If a user
4478
- // explicitly provided `-0` then we need to ensure the sign makes it into the output
4479
4477
  if (Object.is(Math.sign(this.value), -0)) {
4480
- return { $numberDouble: "-".concat(this.value.toFixed(1)) };
4478
+ // NOTE: JavaScript has +0 and -0, apparently to model limit calculations. If a user
4479
+ // explicitly provided `-0` then we need to ensure the sign makes it into the output
4480
+ return { $numberDouble: '-0.0' };
4481
4481
  }
4482
- var $numberDouble;
4483
4482
  if (Number.isInteger(this.value)) {
4484
- $numberDouble = this.value.toFixed(1);
4485
- if ($numberDouble.length >= 13) {
4486
- $numberDouble = this.value.toExponential(13).toUpperCase();
4487
- }
4483
+ return { $numberDouble: "".concat(this.value, ".0") };
4488
4484
  }
4489
4485
  else {
4490
- $numberDouble = this.value.toString();
4486
+ return { $numberDouble: "".concat(this.value) };
4491
4487
  }
4492
- return { $numberDouble: $numberDouble };
4493
4488
  };
4494
4489
  /** @internal */
4495
4490
  Double.fromExtendedJSON = function (doc, options) {