{"id":17194905,"url":"https://github.com/ajermakovics/optional","last_synced_at":"2026-01-05T21:43:18.423Z","repository":{"id":142508498,"uuid":"275593032","full_name":"ajermakovics/optional","owner":"ajermakovics","description":"Optional (Maybe) type in Wren programming language https://wren.io","archived":false,"fork":false,"pushed_at":"2020-06-28T16:57:27.000Z","size":3,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T07:11:15.287Z","etag":null,"topics":["maybe","optional","wren"],"latest_commit_sha":null,"homepage":"","language":null,"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/ajermakovics.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":"2020-06-28T13:41:14.000Z","updated_at":"2024-02-29T16:42:14.000Z","dependencies_parsed_at":null,"dependency_job_id":"e9a2c958-5b8e-416b-b10a-0fdd1eb5a083","html_url":"https://github.com/ajermakovics/optional","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Foptional","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Foptional/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Foptional/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ajermakovics%2Foptional/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ajermakovics","download_url":"https://codeload.github.com/ajermakovics/optional/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245417807,"owners_count":20612015,"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":["maybe","optional","wren"],"created_at":"2024-10-15T01:48:35.308Z","updated_at":"2026-01-05T21:43:13.382Z","avatar_url":"https://github.com/ajermakovics.png","language":null,"readme":"# Optional\n\nOptional type in Wren programming language https://wren.io\n\nAn optional can contain a single value or be empty.\n\n## Examples\n\n```\nvar maybe = Optional.of(\"abc\") // Optional\u003cString\u003e(\"abc\")\nmaybe.isPresent() // true\nmaybe.each { |value| System.print(value) } // prints \"abc\"\n\nvar maybe2 = maybe.map { |str| str + \"123\" } // Optional\u003cString\u003e(\"abc123\")\n\nvar none = Optional.empty() // Optional\u003cEmpty\u003e()\nSystem.print(none.getOr(\"defaultValue\")) // \"defaultValue\"\n\n// pick one of three optionals - first which is not empty\nvar maybe3 = maybeThis | orThis | maybe2 // Optional\u003cString\u003e(\"abc123\")\n\nvar res = Optional.of(request.param).filter { |v| v.count \u003e 0 }.map { |v| v.trim() } // request param without spaces\n\nvar combined = Optional.of(1) + Optional.of(2) // Optional(3)\n\nvar reqParam = combined.flatMap {|value| Optional.of(value + 100) }  // Optional(103)\nSystem.print(reqParam.contains(103)) // true\n\n```\n\n## Usage\n\n```\nimport \"./optional/optional\" for Optional\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajermakovics%2Foptional","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajermakovics%2Foptional","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajermakovics%2Foptional/lists"}