Skip to content

Commit

Permalink
use @feross's is-buffer code
Browse files Browse the repository at this point in the history
  • Loading branch information
williamkapke committed Mar 6, 2015
1 parent 1ef60d8 commit 60cc467
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 16 additions & 1 deletion objectid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,22 @@
var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10);
var index = ObjectID.index = parseInt(Math.random() * 0xFFFFFF, 10);
var pid = typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid % 0xFFFF;
var isBuffer = typeof Buffer !== "undefined"? Buffer.isBuffer : function(){};

/**
* Determine if an object is Buffer
*
* Author: Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* License: MIT
*
*/
var isBuffer = function (obj) {
return !!(
obj != null &&
obj.constructor &&
typeof obj.constructor.isBuffer === 'function' &&
obj.constructor.isBuffer(obj)
)
};

/**
* Create a new immutable ObjectID instance
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bson-objectid",
"version": "1.0.1",
"version": "1.0.2",
"description": "Construct ObjectIDs without the mongodb driver or bson module",
"main": "objectid.js",
"directories": {
Expand Down

0 comments on commit 60cc467

Please sign in to comment.