{"id":22920430,"url":"https://github.com/anatol-grabowski/incstr","last_synced_at":"2025-08-03T23:08:44.182Z","repository":{"id":44626582,"uuid":"91152095","full_name":"anatol-grabowski/incstr","owner":"anatol-grabowski","description":"Increment string or generate sequential string ids","archived":false,"fork":false,"pushed_at":"2022-02-03T17:44:41.000Z","size":9,"stargazers_count":80,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-16T01:21:02.104Z","etag":null,"topics":["javascript","nodejs","npm-module"],"latest_commit_sha":null,"homepage":null,"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/anatol-grabowski.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-05-13T05:37:37.000Z","updated_at":"2023-12-28T06:55:45.000Z","dependencies_parsed_at":"2022-09-17T05:11:12.532Z","dependency_job_id":null,"html_url":"https://github.com/anatol-grabowski/incstr","commit_stats":null,"previous_names":["grabantot/incstr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/anatol-grabowski/incstr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anatol-grabowski%2Fincstr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anatol-grabowski%2Fincstr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anatol-grabowski%2Fincstr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anatol-grabowski%2Fincstr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anatol-grabowski","download_url":"https://codeload.github.com/anatol-grabowski/incstr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anatol-grabowski%2Fincstr/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268625009,"owners_count":24280188,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["javascript","nodejs","npm-module"],"created_at":"2024-12-14T07:15:50.227Z","updated_at":"2025-08-03T23:08:44.151Z","avatar_url":"https://github.com/anatol-grabowski.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# incstr\r\nIncrement strings or generate sequential string ids in node.js or browser\r\n\r\n## Usage\r\n\r\n### incstr\r\n```\r\nconst incstr = require('incstr')\r\nnextStr = incstr(str,\r\n                 [alphabet=incstr.alphabet],\r\n                 [numberlike=incstr.numberlike])\r\n```\r\n- `str` - string to increment;\r\n- `alphabet` - alphabet to use (default `'A..Za..z0..9'`);\r\n- `numberlike` - `'BA'` after `'9'` instead of `'AA'`(default `false`);\r\n- default `alphabet` can be set through `incstr.alphabet`;\r\n- default value for `numberlike` can be set through `incstr.numberlike`;\r\n- works with strings of any length.\r\n\r\n### incstr.idGenerator\r\n```\r\nnextId = incstr.idGenerator(options)\r\nid = nextId() // real generator would be too bulky \"nextId.next().value\"\r\n```\r\nPossible options:\r\n- `options.lastId`;\r\n- `options.alphabet`;\r\n- `options.numberlike`;\r\n- `options.prefix`;\r\n- `options.suffix`.\r\n\r\n`lastId` can also be accessed later through `nextId.lastId` property.\r\nNote that `idGenerator` is more than twice as fast as `incstr`.\r\n\r\n## Examples\r\nPass a string to increment using default alphabet:\r\n\r\n```\r\nlet i = incstr() // \"A\"\r\ni = incstr(i) // \"B\"\r\n...\r\ni = incstr(i) // \"9\"\r\ni = incstr(i) // \"AA\"\r\ni = incstr(i) // \"AB\"\r\n```\r\n\r\nPass a string and an alphabet to use:\r\n```\r\nincstr(\"ccc\", \"abc\") // \"aaaa\"\r\nincstr(\"cc\", \"ab\") // throws ('c' is not in alphabet 'ab')\r\nincstr(\"0\", \"01\") // \"1\"\r\nincstr(\"1\", \"01\") // \"00\", note NOT \"10\"\r\nincstr(\"1\", \"01\", true) // \"10\", numberlike increment\r\n```\r\n\r\nGenerate ids:\r\n\r\n```\r\nconst nextId = incstr.idGenerator()\r\nid1 = nextId() // 'A'\r\nid2 = nextId() // 'B'\r\n```\r\n\r\n```\r\nconst nextId = incstr.idGenerator({alphabet:'ab', prefix:'id_', suffix:''})\r\nnextId() // 'id_a'\r\nnextId() // 'id_b'\r\nnextId() // 'id_aa'\r\n```\r\n\r\n```\r\nconst nextId = incstr.idGenerator({lastId:'cc', alphabet:'abc', numberlike: true})\r\nid = nextId() // 'baa'\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanatol-grabowski%2Fincstr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanatol-grabowski%2Fincstr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanatol-grabowski%2Fincstr/lists"}