validate-objectid

Validates a MongoDB ObjectID. Takes a string, returns a bool.

Usage no npm install needed!

<script type="module">
  import validateObjectid from 'https://cdn.skypack.dev/validate-objectid';
</script>

README

validate-objectid

Usage

var objectid = require('validate-objectid');

assert(! objectid('test'));
assert(objectid('542f9cabed89afee4aaf2e61'));