{"id":13561238,"url":"https://github.com/andre-dietrich/elm-conditional","last_synced_at":"2025-04-04T10:45:42.885Z","repository":{"id":57674777,"uuid":"296049125","full_name":"andre-dietrich/elm-conditional","owner":"andre-dietrich","description":"Conditional application of functions to simplify piping.","archived":false,"fork":false,"pushed_at":"2020-09-16T14:06:41.000Z","size":9,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T20:45:45.820Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elm","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andre-dietrich.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}},"created_at":"2020-09-16T13:58:46.000Z","updated_at":"2023-11-04T19:54:40.000Z","dependencies_parsed_at":"2022-09-02T15:01:26.085Z","dependency_job_id":null,"html_url":"https://github.com/andre-dietrich/elm-conditional","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andre-dietrich%2Felm-conditional","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andre-dietrich%2Felm-conditional/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andre-dietrich%2Felm-conditional/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andre-dietrich%2Felm-conditional/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andre-dietrich","download_url":"https://codeload.github.com/andre-dietrich/elm-conditional/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166149,"owners_count":20894652,"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":[],"created_at":"2024-08-01T13:00:54.020Z","updated_at":"2025-04-04T10:45:42.870Z","avatar_url":"https://github.com/andre-dietrich.png","language":"Elm","funding_links":[],"categories":["Elm"],"sub_categories":[],"readme":"# elm-conditional\n\nThis Library contains a set of functions that are intended to simplify the\napplication of pipes when conditions are required. Instead of using multiple\nif-else-statements, it is possible to pass the condition as the first parameter,\nwhich defines if a functions gets executed or not.\n\nFunctions that have an `If` attached to their name, allow to define conditions\nfor  their applications. If the function-name ends with a `When`, then the\napplication of the passed function is based on a Maybe type and only gets\nexecuted, if this parameter is not equal to Nothing.\n\n``` elm\nimport Conditional as C\n\n...\n  let\n    list = [1,2,3,4,5,6,7,8,9]\n  in\n  -- apply a function only if the first condition is met\n  list\n    |\u003e C.apply2If (++) (List.length list \u003e 5) 5\n    |\u003e (==) [5,1,2,3,4,5,6,7,8,9]\n\n  -- apply a function only if the first parameter is not Nothing\n  list\n    |\u003e C.apply2When (++) (Just 1000)\n    |\u003e (==) [1000,1,2,3,4,5,6,7,8,9]\n\n```\n\nThe sub-modules contain a couple of functions that already abstract List or\nString manipulation. So that you can also apply these functions directly without\nany further if-else-statements.\n\n\n``` elm\nimport Conditional.List as CList\n\n...\n  let\n    list = [1,2,3,4,5,6,7,8,9]\n  in\n  list\n    |\u003e CList.mapIf (List.length list \u003e 5) (\\v -\u003e v * v)\n    |\u003e CList.addIf (List.member 6 list) -99\n    |\u003e CList.attachIf (List.member 7 list) 99\n    |\u003e (==) [-99, 1, 4, 9, 16, 25, 36, 49, 62, 91, 99]\n\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandre-dietrich%2Felm-conditional","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandre-dietrich%2Felm-conditional","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandre-dietrich%2Felm-conditional/lists"}