{"id":22362709,"url":"https://github.com/pragmagic/names","last_synced_at":"2026-04-04T13:02:07.745Z","repository":{"id":87213017,"uuid":"121976858","full_name":"pragmagic/names","owner":"pragmagic","description":"String interning library for Nim","archived":false,"fork":false,"pushed_at":"2018-02-19T18:06:42.000Z","size":4,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T16:17:52.246Z","etag":null,"topics":["nim","strings"],"latest_commit_sha":null,"homepage":null,"language":"Nim","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pragmagic.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-02-18T18:10:28.000Z","updated_at":"2021-01-28T02:21:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"5d75ac14-aeea-4e07-a7cf-63a5bf9d8bad","html_url":"https://github.com/pragmagic/names","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pragmagic/names","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmagic%2Fnames","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmagic%2Fnames/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmagic%2Fnames/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmagic%2Fnames/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pragmagic","download_url":"https://codeload.github.com/pragmagic/names/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pragmagic%2Fnames/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31400460,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-04T10:20:44.708Z","status":"ssl_error","status_checked_at":"2026-04-04T10:20:06.846Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["nim","strings"],"created_at":"2024-12-04T17:11:06.354Z","updated_at":"2026-04-04T13:02:07.725Z","avatar_url":"https://github.com/pragmagic.png","language":"Nim","funding_links":[],"categories":[],"sub_categories":[],"readme":"# names\n\nThis module implements `Name` type, which is an interned string, allowing\nfast comparison and hash retrieval.\n\nConsider using this type when:\n1) You would like to use `string` as a key of a hash table.\n2) Many equal strings can be created in different parts of your application.\n\nAPI:\n```nim\ntype Name* = ref object\n  ## Represents an interned string allowing fast equality and hash operations.\n\nproc toName*(s: string): Name\n  ## Converts the ``string`` to ``Name``.\n  ## Returns ``nil`` if ``s`` is ``nil``.\n\nproc toName*(s: cstring): Name\n  ## Converts the null-terminated ``cstring`` to ``Name``.\n  ## Returns ``nil`` if ``s`` is ``nil``.\n\nproc toExistingName*(s: string): Name\n  ## Returns ``Name`` corresponding to the string, but only if the name\n  ## is already registered. Otherwise returns ``nil``.\n  ## This is useful when you don't want to pollute the name table with\n  ## unverified user input.\n\nproc toExistingName*(s: cstring): Name\n  ## Returns ``Name`` corresponding to the string, but only if the name\n  ## is already registered. Otherwise returns ``nil``.\n  ## This is useful when you don't want to pollute the name table with\n  ## unverified user input.\n\nproc isValid*(name: Name): bool\n  ## Returns ``true`` if the ``name`` is initialized, ``false`` otherwise.\n  ## A name returned from ``toName`` call with a non-nil argument is always\n  ## valid.\n\nproc `==`*(n1, n2: Name): bool\n  ## Returns ``true`` if the names are equal, ``false`` otherwise.\n\nproc hash*(name: Name): Hash\n  ## Returns hash of the ``name``. The hash may not be equal to the hash\n  ## of the string the name represents.\n\nproc cmp*(n1, n2: Name): int\n  ## Returns 0 if the names are equal, a value \u003c 0 if n1 \u003c n2, and\n  ## a value \u003e 0 otherwise.\n  ## The comparison is lexicographic.\n\nproc `\u003c`*(n1, n2: Name): bool\n  ## Returns ``true`` if ``n1`` \u003c ``n2``, ``false`` otherwise.\n  ## The comparison is lexicographic.\n\ntemplate `$`*(name: Name): string\n  ## Returns string representation of the ``name`` or ``nil``, if\n  ## the ``name`` is not valid.\n  ## Implemented as a template to avoid redundant string copies - the\n  ## underlying string is always immutable, so it gets copied only if you\n  ## assign the result to a mutable (``var``) variable.\n```\n\n## License\n\nThis library is licensed under the MIT license.\nRead [LICENSE](LICENSE) file for details.\n\nCopyright (c) 2018 Xored Software, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpragmagic%2Fnames","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpragmagic%2Fnames","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpragmagic%2Fnames/lists"}