bson 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HISTORY.md +4 -0
- package/lib/bson/objectid.js +2 -2
- package/package.json +1 -1
package/HISTORY.md
CHANGED
package/lib/bson/objectid.js
CHANGED
|
@@ -49,7 +49,7 @@ var ObjectID = function ObjectID(id) {
|
|
|
49
49
|
if(!valid && id != null){
|
|
50
50
|
throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters");
|
|
51
51
|
} else if(valid && typeof id == 'string' && id.length == 24 && hasBufferType) {
|
|
52
|
-
return new ObjectID(Buffer
|
|
52
|
+
return new ObjectID(new Buffer(id, 'hex'));
|
|
53
53
|
} else if(valid && typeof id == 'string' && id.length == 24) {
|
|
54
54
|
return ObjectID.createFromHexString(id);
|
|
55
55
|
} else if(id != null && id.length === 12) {
|
|
@@ -290,7 +290,7 @@ ObjectID.createFromHexString = function createFromHexString (string) {
|
|
|
290
290
|
}
|
|
291
291
|
|
|
292
292
|
// Use Buffer.from method if available
|
|
293
|
-
if(hasBufferType) return new ObjectID(Buffer
|
|
293
|
+
if(hasBufferType) return new ObjectID(new Buffer(string, 'hex'));
|
|
294
294
|
|
|
295
295
|
// Calculate lengths
|
|
296
296
|
var array = new _Buffer(12);
|