bson 1.1.5 → 1.1.6
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.
- package/HISTORY.md +7 -0
- package/bower.json +1 -1
- package/lib/bson/long.js +14 -0
- package/lib/bson/parser/serializer.js +6 -0
- package/package.json +2 -2
package/HISTORY.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.6](https://github.com/mongodb/js-bson/compare/v1.1.5...v1.1.6) (2021-03-16)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Throw error on bigint usage and add helpers to Long ([#426](https://github.com/mongodb/js-bson/issues/426)) ([375f368](https://github.com/mongodb/js-bson/commit/375f368738807f2d41c7751e618fd09c8a1b94c9))
|
|
11
|
+
|
|
5
12
|
### [1.1.5](https://github.com/mongodb/js-bson/compare/v1.1.4...v1.1.5) (2020-08-10)
|
|
6
13
|
|
|
7
14
|
|
package/bower.json
CHANGED
package/lib/bson/long.js
CHANGED
|
@@ -77,6 +77,11 @@ Long.prototype.toNumber = function() {
|
|
|
77
77
|
return this.high_ * Long.TWO_PWR_32_DBL_ + this.getLowBitsUnsigned();
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
+
/** Converts the Long to a BigInt (arbitrary precision). */
|
|
81
|
+
Long.prototype.toBigInt = function () {
|
|
82
|
+
return BigInt(this.toString());
|
|
83
|
+
}
|
|
84
|
+
|
|
80
85
|
/**
|
|
81
86
|
* Return the JSON value.
|
|
82
87
|
*
|
|
@@ -711,6 +716,15 @@ Long.fromNumber = function(value) {
|
|
|
711
716
|
}
|
|
712
717
|
};
|
|
713
718
|
|
|
719
|
+
/**
|
|
720
|
+
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
|
721
|
+
* @param {bigint} value - The number in question
|
|
722
|
+
* @returns {Long} The corresponding Long value
|
|
723
|
+
*/
|
|
724
|
+
Long.fromBigInt = function(value) {
|
|
725
|
+
return Long.fromString(value.toString(10), 10);
|
|
726
|
+
}
|
|
727
|
+
|
|
714
728
|
/**
|
|
715
729
|
* Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits.
|
|
716
730
|
*
|
|
@@ -709,6 +709,8 @@ var serializeInto = function serializeInto(
|
|
|
709
709
|
index = serializeString(buffer, key, value, index, true);
|
|
710
710
|
} else if (type === 'number') {
|
|
711
711
|
index = serializeNumber(buffer, key, value, index, true);
|
|
712
|
+
} else if(type === 'bigint') {
|
|
713
|
+
throw new TypeError('Unsupported type BigInt, please use Decimal128');
|
|
712
714
|
} else if (type === 'boolean') {
|
|
713
715
|
index = serializeBoolean(buffer, key, value, index, true);
|
|
714
716
|
} else if (value instanceof Date || isDate(value)) {
|
|
@@ -820,6 +822,8 @@ var serializeInto = function serializeInto(
|
|
|
820
822
|
index = serializeString(buffer, key, value, index);
|
|
821
823
|
} else if (type === 'number') {
|
|
822
824
|
index = serializeNumber(buffer, key, value, index);
|
|
825
|
+
} else if(type === 'bigint') {
|
|
826
|
+
throw new TypeError('Unsupported type BigInt, please use Decimal128');
|
|
823
827
|
} else if (type === 'boolean') {
|
|
824
828
|
index = serializeBoolean(buffer, key, value, index);
|
|
825
829
|
} else if (value instanceof Date || isDate(value)) {
|
|
@@ -923,6 +927,8 @@ var serializeInto = function serializeInto(
|
|
|
923
927
|
index = serializeString(buffer, key, value, index);
|
|
924
928
|
} else if (type === 'number') {
|
|
925
929
|
index = serializeNumber(buffer, key, value, index);
|
|
930
|
+
} else if(type === 'bigint') {
|
|
931
|
+
throw new TypeError('Unsupported type BigInt, please use Decimal128');
|
|
926
932
|
} else if (type === 'boolean') {
|
|
927
933
|
index = serializeBoolean(buffer, key, value, index);
|
|
928
934
|
} else if (value instanceof Date || isDate(value)) {
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"browser_build",
|
|
13
13
|
"bower.json"
|
|
14
14
|
],
|
|
15
|
-
"version": "1.1.
|
|
15
|
+
"version": "1.1.6",
|
|
16
16
|
"author": "Christian Amor Kvalheim <christkv@gmail.com>",
|
|
17
17
|
"contributors": [],
|
|
18
18
|
"repository": "mongodb/js-bson",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"babel-preset-stage-0": "^6.5.0",
|
|
32
32
|
"babel-register": "^6.14.0",
|
|
33
33
|
"conventional-changelog-cli": "^1.3.5",
|
|
34
|
-
"standard-version": "^
|
|
34
|
+
"standard-version": "^9.1.1",
|
|
35
35
|
"webpack": "^1.13.2",
|
|
36
36
|
"webpack-polyfills-plugin": "0.0.9"
|
|
37
37
|
},
|