Socket
Socket
Sign inDemoInstall

bson

Package Overview
Dependencies
Maintainers
4
Versions
162
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bson - npm Package Compare versions

Comparing version 2.0.6 to 2.0.7

10

HISTORY.md

@@ -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 @@

4

package.json

@@ -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

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