Comparing version 2.0.6 to 2.0.7
@@ -0,1 +1,11 @@ | ||
<a name="2.0.7"></a> | ||
## [2.0.7](https://github.com/mongodb/js-bson/compare/v2.0.6...v2.0.7) (2018-05-31) | ||
### Bug Fixes | ||
* **binary:** add type checking for buffer ([cbfb25d](https://github.com/mongodb/js-bson/commit/cbfb25d)) | ||
<a name="2.0.6"></a> | ||
@@ -2,0 +12,0 @@ ## [2.0.6](https://github.com/mongodb/js-bson/compare/v2.0.5...v2.0.6) (2018-04-27) |
@@ -33,2 +33,12 @@ 'use strict'; | ||
if ( | ||
buffer != null && | ||
!(typeof buffer === 'string') && | ||
!Buffer.isBuffer(buffer) && | ||
!(buffer instanceof Uint8Array) && | ||
!Array.isArray(buffer) | ||
) { | ||
throw new Error('only String, Buffer, Uint8Array or Array accepted'); | ||
} | ||
this._bsontype = 'Binary'; | ||
@@ -35,0 +45,0 @@ |
@@ -15,3 +15,3 @@ { | ||
], | ||
"version": "2.0.6", | ||
"version": "2.0.7", | ||
"author": "Christian Amor Kvalheim <christkv@gmail.com>", | ||
@@ -39,3 +39,3 @@ "license": "Apache-2.0", | ||
"mocha": "^3.5.3", | ||
"prettier": "^1.7.0", | ||
"prettier": "~1.12.0", | ||
"webpack": "^3.6.0", | ||
@@ -42,0 +42,0 @@ "webpack-polyfills-plugin": "0.1.0" |
@@ -151,1 +151,19 @@ # BSON parser | ||
The `undefined` BSON type has been [deprecated for many years](http://bsonspec.org/spec.html), so this library has dropped support for it. Use the `ignoreUndefined` option (for example, from the [driver](http://mongodb.github.io/node-mongodb-native/2.2/api/MongoClient.html#connect) ) to instead remove `undefined` keys. | ||
#### How do I add custom serialization logic? | ||
This library looks for `toBSON()` functions on every path, and calls the `toBSON()` function to get the value to serialize. | ||
```javascript | ||
var bson = new BSON(); | ||
class CustomSerialize { | ||
toBSON() { | ||
return 42; | ||
} | ||
} | ||
const obj = { answer: new CustomSerialize() }; | ||
// "{ answer: 42 }" | ||
console.log(bson.deserialize(bson.serialize(obj))); | ||
``` |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
686550
19253
169
2