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

bson-objectid

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bson-objectid - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.idea/libraries/bson_objectid_node_modules.xml

2

objectid.js
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

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