{"id":13724961,"url":"https://github.com/cabinjs/bson-objectid","last_synced_at":"2026-01-15T22:19:04.354Z","repository":{"id":22318856,"uuid":"25654167","full_name":"cabinjs/bson-objectid","owner":"cabinjs","description":"Construct ObjectIDs without the mongodb driver or bson module. Maintained for @forwardemail, @ladjs, @spamscanner, @breejs, @cabinjs, and @lassjs.","archived":false,"fork":false,"pushed_at":"2024-05-08T14:08:58.000Z","size":99,"stargazers_count":209,"open_issues_count":6,"forks_count":33,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-13T04:07:44.879Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cabinjs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-23T19:28:35.000Z","updated_at":"2025-11-23T07:23:05.000Z","dependencies_parsed_at":"2024-12-04T00:18:35.068Z","dependency_job_id":null,"html_url":"https://github.com/cabinjs/bson-objectid","commit_stats":{"total_commits":63,"total_committers":22,"mean_commits":"2.8636363636363638","dds":0.6825396825396826,"last_synced_commit":"66f6f803a14b072f6c8d0d5b713cd02154f00ed0"},"previous_names":["williamkapke/bson-objectid"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/cabinjs/bson-objectid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cabinjs%2Fbson-objectid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cabinjs%2Fbson-objectid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cabinjs%2Fbson-objectid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cabinjs%2Fbson-objectid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cabinjs","download_url":"https://codeload.github.com/cabinjs/bson-objectid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cabinjs%2Fbson-objectid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28472626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-15T22:13:38.078Z","status":"ssl_error","status_checked_at":"2026-01-15T22:12:11.737Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T01:02:08.065Z","updated_at":"2026-01-15T22:19:04.339Z","avatar_url":"https://github.com/cabinjs.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"BSON ObjectID \u0026nbsp;[![Build Status](https://travis-ci.org/williamkapke/bson-objectid.svg?branch=master)](https://travis-ci.org/williamkapke/bson-objectid)\n=============\n\nThis module allows you to create and parse `ObjectID`s without a reference to the\n[mongodb](https://github.com/mongodb/node-mongodb-native) or [bson](https://github.com/mongodb/js-bson)\nmodules.\n\nThe goal is to be 100% compatable with all [bson](https://github.com/mongodb/js-bson)'s\npublic API implementation (found here: https://github.com/mongodb/js-bson/blob/main/src/objectid.ts).\n\n## Install\n    $ npm install bson-objectid\n\n## Usage\n```javascript\nvar ObjectID = require(\"bson-objectid\");\n\nconsole.log(ObjectID());\nconsole.log(ObjectID(\"54495ad94c934721ede76d90\"));\nconsole.log(ObjectID(1414093117));//time\nconsole.log(ObjectID([ 84, 73, 90, 217, 76, 147, 71, 33, 237, 231, 109, 144 ]));\nconsole.log(ObjectID(new Buffer([ 84, 73, 90, 217, 76, 147, 71, 33, 237, 231, 109, 144 ])));\n```\n\n### ObjectID()\u003cbr\u003eObjectID(time)\u003cbr\u003eObjectID(hexString)\u003cbr\u003eObjectID(idString)\u003cbr\u003eObjectID(array)\u003cbr\u003eObjectID(buffer)\nCreates a new immutable `ObjectID` instance based on the current system time.\n\nPossible arguments:\u003cbr\u003e\n**time** Constructs the instance based on the specified time (in seconds).\u003cbr\u003e\n**hexString** Constructs the instance from a 24 character hex string.\u003cbr\u003e\n**idString** Constructs the instance from a 12 byte string.\u003cbr\u003e\n**array** Constructs the instance from an `Array` of 24 bytes.\u003cbr\u003e\n**buffer** Constructs the instance from a 24 byte `Buffer` instance.\u003cbr\u003e\n\n#### id\n**returns** the 12 byte id string.\n\n#### str\n#### toHexString()\n**returns** the `ObjectID` represented as a 24 character hex string.\n\n#### equals(other)\n**returns** true if the `ObjectID`s represent the same underlying value. Otherwise false.\n#### getTimestamp()\n**returns** the generation `Date` (accurate up to the second) that this `ObjectID` was generated.\n\n### ObjectID.createFromTime(time)\nCreates an ObjectID from a time (in seconds) `Number`, with the rest of the `ObjectID` zeroed out. Used for comparisons or sorting the ObjectID.\n\n### ObjectID.createFromHexString(hexString)\nCreates an ObjectID from a 24 character hex string.\n\n### ObjectID.isValid(hexString)\u003cbr\u003eObjectID.isValid(ObjectID)\nChecks if a value is a valid `ObjectID` or 24 character hex string.\n\u003e THE NATIVE DOCUMENTATION ISN'T CLEAR ON THIS GUY!\u003cbr\u003e\n\u003e See: http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html#objectid-isvalid\n\n## Test\n    mocha\n\nor\n\n    npm test\n\nLicense\n=======\nApache v2.0\n\nSee LICENSE file.\n\nSpecial callout to [@feross](https://github.com/feross) for the [is-buffer](https://github.com/feross/is-buffer) code\nused internally to avoid Buffer from being loaded in browserify environments.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcabinjs%2Fbson-objectid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcabinjs%2Fbson-objectid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcabinjs%2Fbson-objectid/lists"}