{"id":31753691,"url":"https://github.com/elemental-mind/asciinumerium","last_synced_at":"2026-01-20T17:01:30.912Z","repository":{"id":317967162,"uuid":"1069536407","full_name":"elemental-mind/asciinumerium","owner":"elemental-mind","description":"Encode, decode and manipulate encoded numbers in readable strings efficiently. ","archived":false,"fork":false,"pushed_at":"2025-10-06T20:23:15.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-11T09:58:08.295Z","etag":null,"topics":["byte-encoding","counter","encoding","string","string-embedded-data","string-encoding","unsigned-integers"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/elemental-mind.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-04T05:52:39.000Z","updated_at":"2025-10-04T11:25:17.000Z","dependencies_parsed_at":"2025-10-04T08:22:55.212Z","dependency_job_id":"7a2e37d2-c5ae-457c-a94c-8450849e024a","html_url":"https://github.com/elemental-mind/asciinumerium","commit_stats":null,"previous_names":["elemental-mind/asciinumerium"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elemental-mind/asciinumerium","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fasciinumerium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fasciinumerium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fasciinumerium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fasciinumerium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elemental-mind","download_url":"https://codeload.github.com/elemental-mind/asciinumerium/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elemental-mind%2Fasciinumerium/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28244761,"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":"2026-01-08T02:00:06.591Z","response_time":241,"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":["byte-encoding","counter","encoding","string","string-embedded-data","string-encoding","unsigned-integers"],"created_at":"2025-10-09T17:53:11.463Z","updated_at":"2026-01-20T17:01:30.907Z","avatar_url":"https://github.com/elemental-mind.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Asciinumerium\n\nA TypeScript library for encoding and decoding unsigned integers into readable ASCII characters. \nProvides functions to read, write, increment, decrement and check values in compact ASCII-encoded numerical representations. \n\nIt's super tiny, extremely fast and tree-shakeable.\n\nThis library was mainly created for use cases where strings and numbers would be interleaved and where an ArrayBuffer might hinder development ergnomics, but where you'd still like the memory benefits of single-byte encoded count trackers etc., as V8 for example stores ASCII-encodable strings as 8 bit arrays.\nThink strings like `...\\\u003ckey\u003e#\\\u003ccount\u003e|\\\u003ckey\u003e#\\\u003ccount\u003e...` e.g. `\"id_xyz#900|id_abc#57\"`. \n\n## Features\n\n- **ASCII Encoding/Decoding**: Encode unsigned integers into compact ASCII strings and decode them back\n- **Increment/Decrement Operations**: Performant arithmetic operations directly on encoded strings minimizing changed digits.\n- **Value Checks**: Check if an encoded value is zero or one\n- **Compact Representation**: Uses a custom ASCII-based encoding for efficient storage\n\n## Installation\n\n```bash\nnpm install asciinumerium\n```\n\n## Concepts\n\n### Character ranges \u0026 identifying numbers\n\nThis library maps numbers from 0 to 63 onto the following character set: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\"`. This means `0 =\u003e 0` all the way to `63 =\u003e \"` to then wrap around to `64 =\u003e 10` and `127 =\u003e 1\"` and so forth.\n\n## Usage\n\n### Encoding and Decoding\n\n```typescript\nimport { readUInt, writeUInt } from 'asciinumerium';\n\nconst encoded = writeUInt(\"#a|\", 1, 2, 42); // Encode 42 into the string\nconsole.log(encoded); // \"#y|\"\n\nconst decoded = readUInt(\"#y|\", 1, 2); // Decode back to number\nconsole.log(decoded); // 42\n```\n\n### Incrementing/Decrementing Values\n\n```typescript\nimport { incrementUInt } from 'asciinumerium';\n\nconst original = \"#a|\";\nconst incremented = incrementUInt(original, 1, 2);\nconsole.log(incremented); // \"#b|\"\n```\n\n### Checking Values\n\n```typescript\nimport { isZero, isOne } from 'asciinumerium';\n\nconsole.log(isZero(\"#:|\", 1, 2)); // true\nconsole.log(isOne(\"#;|\", 1, 2)); // true\n```\n\n## API Reference\n\n### Functions\n\n- **`readUInt(text: string, firstDigitIndexInclusive: number, lastDigitIndexExclusive: number): number`**\n  - Decodes an unsigned integer from the specified substring of the text.\n  - `text`: The string containing the encoded value.\n  - `firstDigitIndexInclusive`: Start index of the encoded digits.\n  - `lastDigitIndexExclusive`: End index (exclusive) of the encoded digits.\n  - Returns: The decoded unsigned integer.\n\n- **`writeUInt(text: string, firstDigitIndexInclusive: number, lastDigitIndexExclusive: number, value: number): string`**\n  - Encodes an unsigned integer into the specified substring of the text.\n  - `text`: The original string.\n  - `firstDigitIndexInclusive`: Start index where to write the encoded digits.\n  - `lastDigitIndexExclusive`: End index (exclusive) where to write the encoded digits.\n  - `value`: The unsigned integer to encode.\n  - Returns: The modified string with the encoded value.\n\n- **`incrementUInt(text: string, firstDigitIndexInclusive: number, lastDigitIndexExclusive: number): string`**\n  - Increments the encoded unsigned integer in the specified substring.\n  - `text`: The string containing the encoded value.\n  - `firstDigitIndexInclusive`: Start index of the encoded digits.\n  - `lastDigitIndexExclusive`: End index (exclusive) of the encoded digits.\n  - Returns: The string with the incremented value.\n\n- **`decrementUInt(text: string, firstDigitIndexInclusive: number, lastDigitIndexExclusive: number): string`**\n  - Decrements the encoded unsigned integer in the specified substring.\n  - `text`: The string containing the encoded value.\n  - `firstDigitIndexInclusive`: Start index of the encoded digits.\n  - `lastDigitIndexExclusive`: End index (exclusive) of the encoded digits.\n  - Returns: The string with the decremented value.\n  - Throws: Error if attempting to decrement below zero.\n\n- **`isZero(text: string, firstDigitIndexInclusive: number, lastDigitIndexExclusive: number): boolean`**\n  - Checks if the encoded value in the specified substring is zero.\n  - `text`: The string containing the encoded value.\n  - `firstDigitIndexInclusive`: Start index of the encoded digits.\n  - `lastDigitIndexExclusive`: End index (exclusive) of the encoded digits.\n  - Returns: True if the value is zero, false otherwise.\n\n- **`isOne(text: string, firstDigitIndexInclusive: number, lastDigitIndexExclusive: number): boolean`**\n  - Checks if the encoded value in the specified substring is one.\n  - `text`: The string containing the encoded value.\n  - `firstDigitIndexInclusive`: Start index of the encoded digits.\n  - `lastDigitIndexExclusive`: End index (exclusive) of the encoded digits.\n  - Returns: True if the value is one, false otherwise.\n\n### Constants\n\n- **`zeroCharValue: number`**: The ASCII value used as the zero digit (58, which is ':').\n- **`maxCharValue: number`**: The maximum ASCII value used for digits (zeroCharValue + 63, which is 'y').\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felemental-mind%2Fasciinumerium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felemental-mind%2Fasciinumerium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felemental-mind%2Fasciinumerium/lists"}