bson-objectid
Advanced tools
Comparing version 1.0.0 to 1.0.1
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; | ||
var pid = typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid % 0xFFFF; | ||
var isBuffer = typeof Buffer !== "undefined"? Buffer.isBuffer : function(){}; | ||
@@ -6,0 +6,0 @@ |
{ | ||
"name": "bson-objectid", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Construct ObjectIDs without the mongodb driver or bson module", | ||
@@ -5,0 +5,0 @@ "main": "objectid.js", |
@@ -15,12 +15,21 @@ BSON ObjectID | ||
## Usage | ||
```javascript | ||
var ObjectID = require("bson-objectid"); | ||
console.log(ObjectID()); | ||
console.log(ObjectID("54495ad94c934721ede76d90")); | ||
console.log(ObjectID(1414093117));//time | ||
console.log(ObjectID([ 84, 73, 90, 217, 76, 147, 71, 33, 237, 231, 109, 144 ])); | ||
console.log(ObjectID(new Buffer([ 84, 73, 90, 217, 76, 147, 71, 33, 237, 231, 109, 144 ]))); | ||
``` | ||
### ObjectID()<br>ObjectID(time)<br>ObjectID(hexString)<br>ObjectID(idString)<br>ObjectID(array)<br>ObjectID(buffer) | ||
Creates a new immutable `ObjectID` instance based on the current system time. | ||
Possible arguments: | ||
**time** Constructs the instance based on the specified time (in seconds). | ||
**hexString** Constructs the instance from a 24 character hex string. | ||
**idString** Constructs the instance from a 12 byte string. | ||
**array** Constructs the instance from an `Array` of 24 bytes. | ||
**buffer** Constructs the instance from a 24 byte `Buffer` instance. | ||
Possible arguments:<br> | ||
**time** Constructs the instance based on the specified time (in seconds).<br> | ||
**hexString** Constructs the instance from a 24 character hex string.<br> | ||
**idString** Constructs the instance from a 12 byte string.<br> | ||
**array** Constructs the instance from an `Array` of 24 bytes.<br> | ||
**buffer** Constructs the instance from a 24 byte `Buffer` instance.<br> | ||
@@ -27,0 +36,0 @@ #### #id |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50246
18
77
1