{"id":22015418,"url":"https://github.com/tsukinoko-kun/opsult","last_synced_at":"2025-07-13T04:38:20.200Z","repository":{"id":64841326,"uuid":"578770371","full_name":"tsukinoko-kun/opsult","owner":"tsukinoko-kun","description":"A simple implementation of Option, Result and Future types in TypeScript","archived":false,"fork":false,"pushed_at":"2023-03-05T11:01:39.000Z","size":797,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T05:45:44.035Z","etag":null,"topics":["future","option","result","result-type","rust","type-library","typescript"],"latest_commit_sha":null,"homepage":"https://frank-mayer.github.io/opsult/","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/tsukinoko-kun.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}},"created_at":"2022-12-15T20:59:36.000Z","updated_at":"2024-03-04T22:17:57.000Z","dependencies_parsed_at":"2024-04-15T16:59:12.585Z","dependency_job_id":"d806e584-a2f4-4088-9c06-a507ab1acdac","html_url":"https://github.com/tsukinoko-kun/opsult","commit_stats":null,"previous_names":["tsukinoko-kun/opsult","frank-mayer/opsult"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tsukinoko-kun/opsult","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fopsult","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fopsult/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fopsult/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fopsult/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsukinoko-kun","download_url":"https://codeload.github.com/tsukinoko-kun/opsult/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fopsult/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259824770,"owners_count":22917340,"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":["future","option","result","result-type","rust","type-library","typescript"],"created_at":"2024-11-30T04:21:45.314Z","updated_at":"2025-06-14T13:38:46.132Z","avatar_url":"https://github.com/tsukinoko-kun.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 style=\"display: flex; flex-direction: column; flex-wrap: nowrap; align-content: center; align-items: center; justify-content: center; gap: 1rem;\"\u003e\n    \u003cimg style=\"height:1.5em; width: 1.5em; transform:translateY(0.25em)\" src=\"https://raw.githubusercontent.com/Frank-Mayer/opsult/main/public/icon.svg\" /\u003e\n    \u003cspan\u003eopsult\u003c/span\u003e\n\u003c/h1\u003e\n\n\u003cdiv style=\"display: flex; flex-direction: row; flex-wrap: nowrap; align-content: center; align-items: center;     justify-content: center; gap: 0.5rem;\"\u003e\n    \u003ca href=\"https://www.typescriptlang.org\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Types-included-blue?logo=typescript\u0026amp;style=plastic\" alt=\"Types included\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-MIT-teal.svg?logo=law\u0026amp;style=plastic\" alt=\"License: MIT\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Frank-Mayer/opsult/actions/workflows/test.yml\"\u003e\u003cimg src=\"https://github.com/Frank-Mayer/opsult/actions/workflows/test.yml/badge.svg\" alt=\"Test\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/Frank-Mayer/opsult/actions/workflows/lint.yml\"\u003e\u003cimg src=\"https://github.com/Frank-Mayer/opsult/actions/workflows/lint.yml/badge.svg\" alt=\"Lint\"\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n## Basic overfiew\n\nA implementation of Option, Result and Future types in TypeScript. If you know Rust, you will feel right at home.\n\n### Option\n\n```TypeScript\nimport { Option } from '@frank-mayer/opsult/Option';\n\nconst a: Option\u003cnumber\u003e = some(1);\nconst b: Option\u003cnumber\u003e = none();\nconst c: Option\u003cnumber\u003e = some(2);\n\na.andThen((x: number) =\u003e c.map((y: number) =\u003e x + y)); // some(3)\nb.andThen((x: number) =\u003e c.map((y: number) =\u003e x + y)); // none()\n```\n\n### Result\n\n```TypeScript\nimport { Result } from '@frank-mayer/opsult/Result';\n\nconst a: Result\u003cnumber, string\u003e = ok(1);\nconst b: Result\u003cnumber, string\u003e = err('error');\nconst c: Result\u003cnumber, string\u003e = ok(2);\n\na.andThen((x: number) =\u003e c.map((y: number) =\u003e x + y)); // ok(3)\nb.andThen((x: number) =\u003e c.map((y: number) =\u003e x + y)); // err('error')\n```\n\n### Future\n\n```TypeScript\nimport { Future } from '@frank-mayer/opsult/Future';\n\nconst fut: Future\u003cnumber, string\u003e = new Future\u003cnumber, string\u003e((ok, err) =\u003e {\n    setTimeout(() =\u003e err(\"timeout\"), 1000);\n\n    complexAsyncOperation((x: number) =\u003e {\n        ok(x);\n    });\n})\n\nconst res: Result\u003cnumber, string\u003e = await fut;\n\nres.match({\n    ok: (x: number) =\u003e console.log(x),\n    err: (e: string) =\u003e console.error(e)\n});\n```\n\n[Read the docs to learn on how to use it.](https://Frank-Mayer.github.io/opsult)\n\n## Installation\n\n```bash\nnpm i @frank-mayer/opsult\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsukinoko-kun%2Fopsult","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsukinoko-kun%2Fopsult","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsukinoko-kun%2Fopsult/lists"}