New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bson-objectid

Package Overview
Dependencies
Maintainers
2
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 2.0.1 to 2.0.2

56

objectid.d.ts

@@ -1,29 +0,37 @@

// Type definitions for bson-objectid 1.3.1
// Project: bson-objectid
// Definitions by: Marcel Ernst <https://www.marcel-ernst.de>
import { Buffer } from 'buffer';
export default ObjectID;
import {Buffer} from 'buffer';
declare class ObjectID {
static createFromTime(time: number): ObjectID;
static createFromHexString(hexString: string): ObjectID;
static isValid(hexString: string):boolean;
static isValid(ObjectID: ObjectID):boolean;
static generate(): string;
static generate(time: number): string;
static toString():string;
export default ObjectID
constructor();
constructor(time: number);
constructor(hexString: string);
constructor(idString: string);
constructor(array: number[]);
constructor(buffer: Buffer);
declare const ObjectID: ObjectIDCtor;
readonly id: string;
readonly str: string;
declare interface ObjectID {
readonly id: string;
readonly str: string;
toHexString(): string;
equals(other: ObjectID): boolean;
getTimestamp(): number;
toHexString(): string;
equals(other: ObjectID): boolean;
getTimestamp(): number;
}
declare interface ObjectIDCtor {
(): ObjectID
(time: number): ObjectID
(hexString: string): ObjectID
(idString: string): ObjectID
(array: number[]): ObjectID
(buffer: Buffer): ObjectID
new(): ObjectID
new(time: number): ObjectID
new(hexString: string): ObjectID
new(idString: string): ObjectID
new(array: number[]): ObjectID
new(buffer: Buffer): ObjectID
createFromTime(time: number): ObjectID;
createFromHexString(hexString: string): ObjectID;
isValid(hexString: string): boolean;
isValid(ObjectID: ObjectID): boolean;
toString(): string;
}
{
"name": "bson-objectid",
"version": "2.0.1",
"version": "2.0.2",
"description": "Construct ObjectIDs without the mongodb driver or bson module",

@@ -5,0 +5,0 @@ "main": "objectid.js",

@@ -54,2 +54,34 @@ /// <reference path="../objectid.d.ts" />

// ----------------------------------------------------------------------------
// should construct with no arguments
oid = ObjectID();
// ----------------------------------------------------------------------------
// should have an `id` property
oid.id;
// ----------------------------------------------------------------------------
// should have a `str` property
oid.str;
// ----------------------------------------------------------------------------
// should construct with a `time` argument
oid = ObjectID(time);
// ----------------------------------------------------------------------------
// should construct with an `array` argument
oid = ObjectID(array);
// ----------------------------------------------------------------------------
// should construct with a `buffer` argument
oid = ObjectID(buffer);
// ----------------------------------------------------------------------------
// should construct with a `hexString` argument
oid = ObjectID(hexString);
// ----------------------------------------------------------------------------
// should construct with a `idString` argument
oid = ObjectID(idString);
// ----------------------------------------------------------------------------
// should correctly retrieve timestamp

@@ -56,0 +88,0 @@ const timestamp:number = oid.getTimestamp();

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