{"id":18686848,"url":"https://github.com/yakiyo/result_rs","last_synced_at":"2026-05-02T01:35:05.838Z","repository":{"id":65907905,"uuid":"598659791","full_name":"Yakiyo/result_rs","owner":"Yakiyo","description":"Rust's Result implementation in Javascript","archived":false,"fork":false,"pushed_at":"2023-04-28T17:04:55.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-28T14:02:35.015Z","etag":null,"topics":["deno","deno-module","dnt","rust-result"],"latest_commit_sha":null,"homepage":"https://deno.land/x/result_rs","language":"TypeScript","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/Yakiyo.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":"2023-02-07T15:03:30.000Z","updated_at":"2023-02-15T15:28:19.000Z","dependencies_parsed_at":"2024-11-07T10:34:20.013Z","dependency_job_id":"69ba9010-62fb-44b4-9657-c0f070a267ad","html_url":"https://github.com/Yakiyo/result_rs","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":"0.030303030303030276","last_synced_commit":"6fac66c6bad13e22717e358c19f55f1e68350a18"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fresult_rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fresult_rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fresult_rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yakiyo%2Fresult_rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yakiyo","download_url":"https://codeload.github.com/Yakiyo/result_rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239542115,"owners_count":19656149,"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":["deno","deno-module","dnt","rust-result"],"created_at":"2024-11-07T10:29:31.388Z","updated_at":"2025-11-08T00:30:33.392Z","avatar_url":"https://github.com/Yakiyo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# result-rs \u003cimg src=\"https://github.com/Yakiyo/result_rs/actions/workflows/ci.yml/badge.svg\"\u003e\n\nRust's [Result](https://doc.rust-lang.org/std/result/enum.Result.html)\nenum ported to Typescript/Javascript\n\n## Installation\n\nImport the module to your code:\n\n```ts\nimport { Result } from 'https://deno.land/x/result_rs/mod.ts';\n```\n\nIt is also published as a [npm](npmjs.com/) module as result_rs.\n\n```bash\n$ npm i result_rs\n# or using pnpm\n$ pnpm add result_rs\n# or yarn\n$ yarn add result_rs\n```\n\nThen you can import it in your code:\n\n```ts\n// Commonjs require\nconst { Result } = require('result_rs');\n// ES Module import\nimport { Result } from 'result_rs';\n```\n\n## Usage\n\nUse the `Result.from` method to create a new instance of Result\n\n```ts\nconst result = Result.from(someFunctionThatThrows);\n\nresult.is_ok(); // Returns false if function throwed an error\n```\n\nThe package also exports two utility functions `Ok` and `Err` that are\nuseful to create Ok or Err values from simple values instead of a\nfunction\n\n```ts\nimport { Err, Ok } from 'https://deno.land/x/result_rs/mod.ts';\n\nconst ok = Ok('Hello World');\n\nok.is_ok(); // true;\nok.unwrap(); // 'Hello World'\n\nconst err = Err('Error value');\nerr.is_er(); // true;\nerr.unwrap(); // throws an error\n```\n\nPassing async functions to the `Result.from` method are handled like\nsynchronous functions. If you want to resolve the internal value's\npromise, you can use the `Result.sync` method on any instance to\nresolve the promise internally.\n\n```ts\nconst result = Result.from(async () =\u003e 'Hello World');\nresult.unwrap(); // Promise\u003cstring\u003e\n\nawait result.sync();\nresult.unwrap(); // 'Hello World'\n```\n\nDocumentation of all methods is available\n[here](https://deno.land/x/result_rs?doc).\n\n## Author\n\n**result-rs** © [Yakiyo](https://github.com/Yakiyo). Authored and\nmaintained by Yakiyo.\n\nReleased under [MIT](https://opensource.org/licenses/MIT) License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakiyo%2Fresult_rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyakiyo%2Fresult_rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyakiyo%2Fresult_rs/lists"}