@tybys/oid
TypeScript icon, indicating that this package has built-in type declarations

4.0.0 • Public • Published

oid-js

Use MongoDB ObjectID without installing bson.

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/src/objectid.ts.

API Documentation

/@tybys/oid/

    Package Sidebar

    Install

    npm i @tybys/oid

    Weekly Downloads

    471

    Version

    4.0.0

    License

    MIT

    Unpacked Size

    159 kB

    Total Files

    13

    Last publish

    Collaborators

    • toyobayashi