1.0.5 • Published 5 years ago

string-to-objectid v1.0.5

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

String to OID

Pretty self-explanatory

Install

npm i string-to-objectid

Usage

JavaScript

const stringToOID = require('string-to-objectid')

const s = 'not a valid OID'
stringToOID(s) // Will throw a TypeError
const stringToOID = require('string-to-objectid')

const s = '5dad562161791408b2b0e639'
stringToOID(s) // ObjectId('5dad562161791408b2b0e639')

TypeScript

import stringToOID from 'string-to-objectid'

const s = 'not a valid OID'
stringToOID(s) // Will throw a TypeError
const stringToOID = require('string-to-objectid')

const s = '5dad562161791408b2b0e639'
stringToOID(s) // ObjectId('5dad562161791408b2b0e639')
1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.0

5 years ago