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

@tybys/oid

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tybys/oid

Use MongoDB ObjectID without installing bson.

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
251
decreased by-51.82%
Maintainers
1
Weekly downloads
 
Created
Source

oid-js

Use MongoDB ObjectID without installing bson.

  • dist/oid.js: 20KB
  • dist/oid.min.js: 8KB

Usage

$ npm install @tybys/oid

CLI

$ oid -h
Usage: oid [options]

Options:
  -v, -V, --version   output the version number
  -h, --help          output usage information
  -n, --number <N>    output N number of ObjectIds

Repo: https://github.com/toyobayashi/oid

Browser

IE OK!

<script src="https://cdn.jsdelivr.net/npm/@tybys/oid/dist/oid.min.js"></script>

<script>
console.log(new oid.ObjectId().toHexString());
</script>

Node.js

const { ObjectId } = require('@tybys/oid')
console.log(new ObjectId())

TypeScript

import { ObjectId } from '@tybys/oid'
console.log(new ObjectId())

API

Same as mongodb/js-bson/lib/objectid.js.

See index.d.ts.

export declare interface EmptyDocument {
  $oid: string;
}

export declare interface Document extends EmptyDocument {
  [field: string]: any;
}

export declare class ObjectId {
  constructor(id?: number | string | number[] | Uint8Array | ObjectId);

  static createFromTime(time: number): ObjectId;

  static createFromHexString(hexString: string): ObjectId;

  static isValid(otherId: number | string | number[] | Uint8Array | ObjectId): boolean;

  static createPk(): ObjectId;

  static generate(time?: number): number[] | Uint8Array;

  static getInc(): number;

  static fromExtendedJSON(doc: Document): ObjectId;

  static index: number;

  readonly id: string | number[] | Uint8Array;

  readonly _bsontype: 'ObjectID';

  generationTime: number;

  toHexString(): string;

  equals(otherId: string | number[] | Uint8Array | ObjectId): boolean;

  getTimestamp(): Date;

  toString(format?: string): string;

  toJSON(): string;

  toExtendedJSON(): EmptyDocument;
}

Keywords

FAQs

Package last updated on 02 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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