{"id":17398430,"url":"https://github.com/vweevers/unique-lexicographic-integer","last_synced_at":"2025-03-29T20:15:40.165Z","repository":{"id":55828228,"uuid":"108090002","full_name":"vweevers/unique-lexicographic-integer","owner":"vweevers","description":"lexicographic-integer plus a suffix if input is the same as the last call.","archived":false,"fork":false,"pushed_at":"2020-12-11T17:49:47.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T21:39:08.109Z","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:08:33.000Z","updated_at":"2023-12-16T14:12:47.000Z","dependencies_parsed_at":"2022-08-15T07:31:18.084Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/unique-lexicographic-integer","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%2Funique-lexicographic-integer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funique-lexicographic-integer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funique-lexicographic-integer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Funique-lexicographic-integer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/unique-lexicographic-integer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246237436,"owners_count":20745348,"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:56:18.453Z","updated_at":"2025-03-29T20:15:40.140Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# unique-lexicographic-integer\n\n**[`lexicographic-integer`] plus a suffix if input is the same as the last call. Hex-encoded.**\n\n[![npm status](http://img.shields.io/npm/v/unique-lexicographic-integer.svg?style=flat-square)](https://www.npmjs.org/package/unique-lexicographic-integer) [![node](https://img.shields.io/node/v/unique-lexicographic-integer.svg?style=flat-square)](https://www.npmjs.org/package/unique-lexicographic-integer) [![Travis build status](https://img.shields.io/travis/vweevers/unique-lexicographic-integer.svg?style=flat-square\u0026label=travis)](http://travis-ci.org/vweevers/unique-lexicographic-integer) [![AppVeyor build status](https://img.shields.io/appveyor/ci/vweevers/unique-lexicographic-integer.svg?style=flat-square\u0026label=appveyor)](https://ci.appveyor.com/project/vweevers/unique-lexicographic-integer) [![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/unique-lexicographic-integer.svg?style=flat-square)](https://david-dm.org/vweevers/unique-lexicographic-integer)\n\n## example\n\n```js\nconst uli = require('unique-lexicographic-integer')\nconst encode = uli()\n\nconsole.log(encode(0)) // '00'\nconsole.log(encode(0)) // '00.01'\nconsole.log(encode(1)) // '01'\nconsole.log(encode(300)) // 'fb31'\nconsole.log(encode(300)) // 'fb31.01'\nconsole.log(encode(300)) // 'fb31.02'\n\nconst strict = uli({ strict: true })\n\ntry {\n  strict('1')\n} catch (err) {\n  console.log(err.message) // 'Argument must be a valid number'\n}\n```\n\n## api\n\n### `encode = require('unique-lexicographic-integer')([options])`\n\n- `options.separator` (string): defaults to `'.'`\n- `options.strict` (boolean): opt-in to type-checking input. Handled by [`lexicographic-integer-encoding`]. If true, encode 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- [`lexicographic-integer`]: main encoding logic\n- [`lexicographic-integer-encoding`]: encoding for `level(up)`\n- [`monotonic-lexicographic-timestamp`]: `unique-lexicographic-integer` with `Date.now()` as input to get a monotonically increasing timestamp with lexicographic order.\n\n## install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install unique-lexicographic-integer\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[`monotonic-lexicographic-timestamp`]: https://github.com/vweevers/monotonic-lexicographic-timestamp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Funique-lexicographic-integer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Funique-lexicographic-integer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Funique-lexicographic-integer/lists"}