Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mongodb-extjson

Package Overview
Dependencies
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongodb-extjson - npm Package Compare versions

Comparing version 2.1.3 to 2.1.4

11

CHANGELOG.md

@@ -0,1 +1,12 @@

<a name="2.1.4"></a>
## [2.1.4](https://github.com/mongodb-js/mongodb-extjson/compare/v2.1.3...v2.1.4) (2018-05-31)
### Bug Fixes
* **binary:** generate valid base64 for non-Buffer types ([44afbb8](https://github.com/mongodb-js/mongodb-extjson/commit/44afbb8))
* **parsing:** support encoding and decoding RegExps ([06691f6](https://github.com/mongodb-js/mongodb-extjson/commit/06691f6))
<a name="2.1.3"></a>

@@ -2,0 +13,0 @@ ## [2.1.3](https://github.com/mongodb-js/mongodb-extjson/compare/v2.1.2...v2.1.3) (2018-05-01)

10

dist/bundle.js

@@ -20,3 +20,3 @@ (function (global, factory) {

function toExtendedJSON(obj) {
var base64String = obj.buffer.toString('base64');
var base64String = Buffer.isBuffer(obj.buffer) ? obj.buffer.toString('base64') : Buffer.from(obj.buffer).toString('base64');

@@ -459,4 +459,10 @@ return {

}
_doc[name] = serializeValue(val, options);
if (val instanceof RegExp) {
var flags = val.flags;
if (flags === undefined) {
flags = val.toString().match(/[gimuy]*$/)[0];
}
_doc[name] = bson$1['BSONRegExp'].toExtendedJSON({ pattern: val.source, options: flags });
}
}

@@ -463,0 +469,0 @@

4

lib/bson/binary.js

@@ -13,3 +13,5 @@ 'use strict';

function toExtendedJSON(obj) {
var base64String = obj.buffer.toString('base64');
var base64String = Buffer.isBuffer(obj.buffer)
? obj.buffer.toString('base64')
: Buffer.from(obj.buffer).toString('base64');

@@ -16,0 +18,0 @@ return {

@@ -233,4 +233,10 @@ 'use strict';

}
_doc[name] = serializeValue(val, options);
if (val instanceof RegExp) {
let flags = val.flags;
if (flags === undefined) {
flags = val.toString().match(/[gimuy]*$/)[0];
}
_doc[name] = codecs['BSONRegExp'].toExtendedJSON({ pattern: val.source, options: flags });
}
}

@@ -237,0 +243,0 @@

{
"name": "mongodb-extjson",
"version": "2.1.3",
"version": "2.1.4",
"description": "MongoDB Extended JSON library",

@@ -45,3 +45,3 @@ "main": "index.js",

"mongodb": "^2.2.27",
"prettier": "^1.7.0",
"prettier": "~1.12.0",
"rollup": "^0.56.2",

@@ -53,4 +53,4 @@ "rollup-plugin-babel": "^3.0.3",

"dependencies": {
"bson": "^2.0.5"
"bson": "^2.0.7"
}
}

@@ -167,2 +167,5 @@ 'use strict';

expect(serialized).to.equal('{"_id":{"$nin":[{"$oid":"591801a468f9e7024b6235ea"}]}}');
serialized = extJSON.stringify(new Binary(new Uint8Array([1, 2, 3, 4, 5])));
expect(serialized).to.equal('{"$binary":{"base64":"AQIDBAU=","subType":"00"}}');
});

@@ -205,4 +208,13 @@

});
it('should allow regexp', function() {
const parsedRegExp = extJSON.stringify({ test: /some-regex/i }, { relaxed: true });
const parsedBSONRegExp = extJSON.stringify(
{ test: new BSONRegExp('some-regex', 'i') },
{ relaxed: true }
);
expect(parsedRegExp).to.eql(parsedBSONRegExp);
});
});
});
});

Sorry, the diff of this file is not supported yet

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