{"id":17398472,"url":"https://github.com/vweevers/monotonic-lexicographic-timestamp","last_synced_at":"2025-04-30T05:22:19.966Z","repository":{"id":55828330,"uuid":"108094253","full_name":"vweevers/monotonic-lexicographic-timestamp","owner":"vweevers","description":"Monotonically increasing timestamp with lexicographic order.","archived":false,"fork":false,"pushed_at":"2020-12-11T17:48:26.000Z","size":1,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-25T01:58:21.388Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vweevers.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}},"created_at":"2017-10-24T07:48:53.000Z","updated_at":"2023-12-16T14:08:40.000Z","dependencies_parsed_at":"2022-08-15T07:31:19.021Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/monotonic-lexicographic-timestamp","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fmonotonic-lexicographic-timestamp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fmonotonic-lexicographic-timestamp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fmonotonic-lexicographic-timestamp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fmonotonic-lexicographic-timestamp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/monotonic-lexicographic-timestamp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251645987,"owners_count":21620847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-10-16T14:57:04.633Z","updated_at":"2025-04-30T05:22:19.929Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# monotonic-lexicographic-timestamp\n\n**Monotonically increasing timestamp with lexicographic order. Simply adds a suffix if time is the same as the last call. Hex-encoded.**\n\n[![npm status](http://img.shields.io/npm/v/monotonic-lexicographic-timestamp.svg?style=flat-square)](https://www.npmjs.org/package/monotonic-lexicographic-timestamp) [![node](https://img.shields.io/node/v/monotonic-lexicographic-timestamp.svg?style=flat-square)](https://www.npmjs.org/package/monotonic-lexicographic-timestamp) [![Travis build status](https://img.shields.io/travis/vweevers/monotonic-lexicographic-timestamp.svg?style=flat-square\u0026label=travis)](http://travis-ci.org/vweevers/monotonic-lexicographic-timestamp) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/monotonic-lexicographic-timestamp.svg?style=flat-square\u0026label=appveyor)](https://ci.appveyor.com/project/vweevers/monotonic-lexicographic-timestamp) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](https://standardjs.com) [![Dependency status](https://img.shields.io/david/vweevers/monotonic-lexicographic-timestamp.svg?style=flat-square)](https://david-dm.org/vweevers/monotonic-lexicographic-timestamp)\n\n## example\n\n```js\nconst mlts = require('monotonic-lexicographic-timestamp')()\n\n// You can provide your own date or timestamp\nconsole.log(mlts(new Date(0))) // '00'\nconsole.log(mlts(0)) // '00.01'\n\n// Otherwise it'll use Date.now()\nconsole.log(mlts())\nconsole.log(mlts())\n\nconst custom = require('monotonic-lexicographic-timestamp')({\n  separator: '!'\n})\n\nconsole.log(custom(1508832007017)) // 'ff080afa6b2a9370'\nconsole.log(custom(1508832007017)) // 'ff080afa6b2a9370!01'\nconsole.log(custom(1508832007017)) // 'ff080afa6b2a9370!02'\nconsole.log(custom(1508832007018)) // 'ff080afa6b2a9378'\n```\n\n## api\n\n### `mlts = require('monotonic-lexicographic-timestamp')([options])`\n\nOptions are passed to [`unique-lexicographic-integer`]:\n\n- `options.separator` (string): defaults to `'.'`\n- `options.strict` (boolean): opt-in to type-checking input. If true, `mlts()` will throw:\n  - A `TypeError` if input is not a number or if `NaN`\n  - A `RangeError` if input is \u003c 0 or \u003e `Number.MAX_SAFE_INTEGER`.\n\n## see also\n\n- [`monotonic-timestamp`]: if you want floats\n- [`monotonic-timestamp-base36`]: if you want to save bytes\n- [`lexicographic-integer`]: main encoding logic\n- [`lexicographic-integer-encoding`]: encoding for `level(up)`\n- [`unique-lexicographic-integer`]: `lexicographic-integer` plus a suffix if input is the same as the last call.\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install monotonic-lexicographic-timestamp\n```\n\n## license\n\n[MIT](http://opensource.org/licenses/MIT) © Vincent Weevers\n\n[`lexicographic-integer`]: https://github.com/substack/lexicographic-integer\n[`lexicographic-integer-encoding`]: https://github.com/vweevers/lexicographic-integer-encoding\n[`unique-lexicographic-integer`]: https://github.com/vweevers/unique-lexicographic-integer\n[`monotonic-timestamp`]: https://github.com/dominictarr/monotonic-timestamp\n[`monotonic-timestamp-base36`]: https://github.com/nathan7/monotonic-timestamp-base36\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fmonotonic-lexicographic-timestamp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fmonotonic-lexicographic-timestamp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fmonotonic-lexicographic-timestamp/lists"}