{"id":15483398,"url":"https://github.com/hackergrrl/bisecting-between","last_synced_at":"2025-09-13T17:32:49.536Z","repository":{"id":143858141,"uuid":"52995638","full_name":"hackergrrl/bisecting-between","owner":"hackergrrl","description":":hocho: Produces a unique value that sorts between two other given values.","archived":false,"fork":false,"pushed_at":"2016-07-05T18:22:38.000Z","size":9,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-28T21:44:25.007Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hackergrrl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-03-02T20:51:45.000Z","updated_at":"2018-08-25T18:25:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"f408a33e-f99b-4339-a105-9dd7023dac1c","html_url":"https://github.com/hackergrrl/bisecting-between","commit_stats":null,"previous_names":["noffle/bisecting-between"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fbisecting-between","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fbisecting-between/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fbisecting-between/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hackergrrl%2Fbisecting-between/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hackergrrl","download_url":"https://codeload.github.com/hackergrrl/bisecting-between/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232896711,"owners_count":18593521,"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-02T05:14:56.433Z","updated_at":"2025-01-07T14:46:49.934Z","avatar_url":"https://github.com/hackergrrl.png","language":"JavaScript","readme":"# bisecting-between\n\n\u003e Produces a unique value that sorts between two other given values.\n\n## background\n\nThis module makes it easy to select a unique value between any two bisecting\nnumbers, where there are always unique values between any two such numbers. Read\nmore about [bisecting numbers\nhere](https://github.com/noffle/bisecting-numbers).\n\nThis module is inspired by Dominic Tarr's\n[between](https://github.com/dominictarr/between) module. This module aims to\noffer an equivalent API with the same key property of being commutative (i.e.\ninserting between two items does not change the positions of nodes later in a\ncreated list).\n\n`between` is great, but the length of the identifier in the case of consecutive appends\nand prepends is very expensive, growing linearly:\n\n```js\nvar n = between(between.lo, between.hi)\nfor (var i=0; i \u003c 100; i++) {\n  if (i % 10 === 0) {\n    console.log(n)\n  }\n  n = between(n, between.hi)\n}\n```\n\n```\nV\nzy\nzzzs\nzzzzzV\nzzzzzzy\nzzzzzzzzs\nzzzzzzzzzzV\nzzzzzzzzzzzy\nzzzzzzzzzzzzzs\nzzzzzzzzzzzzzzzV\n```\n\n`bisecting-between` optimizes for minimizing the growth of string\nlength in the append and prepend cases, growing logarithmically:\n\n```\n0\nA\nK\nU\ne\no\ny\n18\n1I\n1S\n```\n\nThis trade-off makes random insertions more growth expensive instead. In\ncertain applications (like text editors), long appends and prepends are far more\ncommon.\n\n## example\n\n```js\n\u003e var between = require('bisecting-between')()\n\n\u003e between()\n'0'\n\n\u003e between('A', 'B')\n'A.0'\n\n\u003e between('A.0', between.hi)\nA.1\n\n\u003e between('E.C', 'F')\n'E.D'\n```\n\n## api\n\n### var between = BisectingBetween(alphabet)\n\nReturns a function (that generates values between two other values) across the\ngiven string `alphabet` (where `alphabet.charAt(0)` is the zero value, the next\nis 1, etc). If not provided, the alphabet is the string\n`'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'`.\n\n### between(lo, hi)\n\nReturns a [bisecting number](https://github.com/noffle/bisecting-numbers) that\nis between two other bisecting numbers that will always sort as between `lo` and\n`hi`.\n\n### between.lo, between.hi\n\nFixed values that symbolize the absolute lowest and highest, respectively.\n\n## install\n\nWith [npm](https://npmjs.org/) installed, run\n\n```\n$ npm install bisecting-between\n```\n\n## license\n\nISC\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackergrrl%2Fbisecting-between","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhackergrrl%2Fbisecting-between","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhackergrrl%2Fbisecting-between/lists"}