bson
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -25,3 +25,3 @@ { | ||
], | ||
"version": "1.1.5" | ||
"version": "1.1.6" | ||
} |
@@ -5,2 +5,9 @@ # Changelog | ||
### [1.1.6](https://github.com/mongodb/js-bson/compare/v1.1.5...v1.1.6) (2021-03-16) | ||
### Bug Fixes | ||
* 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)) | ||
### [1.1.5](https://github.com/mongodb/js-bson/compare/v1.1.4...v1.1.5) (2020-08-10) | ||
@@ -7,0 +14,0 @@ |
@@ -80,2 +80,7 @@ // Licensed under the Apache License, Version 2.0 (the "License"); | ||
/** Converts the Long to a BigInt (arbitrary precision). */ | ||
Long.prototype.toBigInt = function () { | ||
return BigInt(this.toString()); | ||
} | ||
/** | ||
@@ -716,2 +721,11 @@ * Return the JSON value. | ||
/** | ||
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. | ||
* @param {bigint} value - The number in question | ||
* @returns {Long} The corresponding Long value | ||
*/ | ||
Long.fromBigInt = function(value) { | ||
return Long.fromString(value.toString(10), 10); | ||
} | ||
/** | ||
* 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. | ||
@@ -718,0 +732,0 @@ * |
@@ -712,2 +712,4 @@ 'use strict'; | ||
index = serializeNumber(buffer, key, value, index, true); | ||
} else if(type === 'bigint') { | ||
throw new TypeError('Unsupported type BigInt, please use Decimal128'); | ||
} else if (type === 'boolean') { | ||
@@ -824,2 +826,4 @@ index = serializeBoolean(buffer, key, value, index, true); | ||
index = serializeNumber(buffer, key, value, index); | ||
} else if(type === 'bigint') { | ||
throw new TypeError('Unsupported type BigInt, please use Decimal128'); | ||
} else if (type === 'boolean') { | ||
@@ -928,2 +932,4 @@ index = serializeBoolean(buffer, key, value, index); | ||
index = serializeNumber(buffer, key, value, index); | ||
} else if(type === 'bigint') { | ||
throw new TypeError('Unsupported type BigInt, please use Decimal128'); | ||
} else if (type === 'boolean') { | ||
@@ -930,0 +936,0 @@ index = serializeBoolean(buffer, key, value, index); |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"author": "Christian Amor Kvalheim <christkv@gmail.com>", | ||
@@ -35,3 +35,3 @@ "contributors": [], | ||
"conventional-changelog-cli": "^1.3.5", | ||
"standard-version": "^7.1.0", | ||
"standard-version": "^9.1.1", | ||
"webpack": "^1.13.2", | ||
@@ -38,0 +38,0 @@ "webpack-polyfills-plugin": "0.0.9" |
774595
21535