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

bson

Package Overview
Dependencies
Maintainers
2
Versions
163
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 0.1.8 to 0.1.9

8

lib/bson/objectid.js

@@ -44,3 +44,3 @@ /**

return ObjectID.createFromHexString(id);
} else if(!checkForHexRegExp.test(id)) {
} else {
throw new Error("Value passed in is not a valid 24 character hex string");

@@ -169,5 +169,5 @@ }

/**
* Returns the generation time in seconds that this ID was generated.
* Returns the generation date (accurate up to the second) that this ID was generated.
*
* @return {Number} return number of seconds in the timestamp part of the 12 byte id.
* @return {Date} the generation date
* @api public

@@ -255,2 +255,2 @@ */

exports.ObjectID = ObjectID;
exports.ObjectId = ObjectID;
exports.ObjectId = ObjectID;
{ "name" : "bson"
, "description" : "A bson parser for node.js and the browser"
, "keywords" : ["mongodb", "bson", "parser"]
, "version" : "0.1.8"
, "version" : "0.1.9"
, "author" : "Christian Amor Kvalheim <christkv@gmail.com>"

@@ -6,0 +6,0 @@ , "contributors" : []

@@ -1,1 +0,45 @@

A JS/C++ Bson parser for node, used in the MongoDB Native driver
Javascript + C++ BSON parser
============================
This BSON parser is primarily meant for usage with the `mongodb` node.js driver. However thanks to such wonderful tools at `onejs` we are able to package up a BSON parser that will work in the browser aswell. The current build is located in the `browser_build/bson.js` file.
A simple example on how to use it
<head>
<script src="https://raw.github.com/mongodb/js-bson/master/browser_build/bson.js">
</script>
</head>
<body onload="start();">
<script>
function start() {
var BSON = bson().BSON;
var Long = bson().Long;
var doc = {long: Long.fromNumber(100)}
// Serialize a document
var data = BSON.serialize(doc, false, true, false);
// De serialize it again
var doc_2 = BSON.deserialize(data);
}
</script>
</body>
It's got two simple methods to use in your application.
* BSON.serialize(object, checkKeys, asBuffer, serializeFunctions)
* @param {Object} object the Javascript object to serialize.
* @param {Boolean} checkKeys the serializer will check if keys are valid.
* @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**.
* @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**
* @return {TypedArray/Array} returns a TypedArray or Array depending on what your browser supports
* BSON.deserialize(buffer, options, isArray)
* Options
* **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized.
* **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse.
* **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function.
* @param {TypedArray/Array} a TypedArray/Array containing the BSON data
* @param {Object} [options] additional options used for the deserialization.
* @param {Boolean} [isArray] ignore used for recursive parsing.
* @return {Object} returns the deserialized Javascript Object.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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