{"id":18593869,"url":"https://github.com/janstuemmel/yep","last_synced_at":"2026-01-29T05:38:17.830Z","repository":{"id":228248957,"uuid":"772708734","full_name":"janstuemmel/yep","owner":"janstuemmel","description":"Easy functional programming with Typescript ","archived":false,"fork":false,"pushed_at":"2024-07-01T12:06:47.000Z","size":94,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-10T02:25:28.278Z","etag":null,"topics":["category-theory","fp","functional-programming","futures","javascript","promises","typescript"],"latest_commit_sha":null,"homepage":"","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/janstuemmel.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":"2024-03-15T18:21:20.000Z","updated_at":"2024-10-03T21:48:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"0cecf23d-c1f2-42a2-b0ac-8ce95b286b34","html_url":"https://github.com/janstuemmel/yep","commit_stats":null,"previous_names":["janstuemmel/yep"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janstuemmel%2Fyep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janstuemmel%2Fyep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janstuemmel%2Fyep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/janstuemmel%2Fyep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/janstuemmel","download_url":"https://codeload.github.com/janstuemmel/yep/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240974391,"owners_count":19887298,"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":["category-theory","fp","functional-programming","futures","javascript","promises","typescript"],"created_at":"2024-11-07T01:13:50.167Z","updated_at":"2026-01-29T05:38:17.803Z","avatar_url":"https://github.com/janstuemmel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# yep\n\nA functional programming library that treats every result as promise \nand therefor doesn't differentiate between async and sync code.\n\nThe code should showcase that fp is not hard in typecript.\n\nPlease look at examples and tests.\n\n## Usage\n\n```ts\nimport {type Box, all, flat, map, nah, or, pipe, tap, yep} from './lib.js';\n\nclass HttpError extends Error {}\nclass ParseError extends Error {}\n\nconst req = (url: string): Box\u003cResponse, HttpError\u003e =\u003e\n  fetch(url)\n    .then(yep)\n    .catch(() =\u003e nah(new HttpError('http error')));\n\nconst parse = \u003cT\u003e(res: Response): Box\u003cT, ParseError\u003e =\u003e\n  res\n    .json()\n    .then((json) =\u003e yep(json as T))\n    .catch(() =\u003e nah(new ParseError('json parse error')));\n\nconst checkStatus = (res: Response) =\u003e\n  res.status \u003e= 400 ? nah(new HttpError('status error')) : yep(res);\n\nconst getPokemon = (name: string) =\u003e\n  pipe(\n    yep(`https://pokeapi.co/api/v2/pokemon/${name}`),\n    flat(req),\n    tap((res) =\u003e console.log(`Requested ${name} with response status ${res.status}`)),\n    flat(checkStatus),\n    flat(parse\u003c{weight: number; name: string}\u003e),\n  );\n\nconst program = pipe(\n  yep(['ditto', 'onix']),\n  flat((names) =\u003e all(names.map(getPokemon))),\n  map(([v, w]) =\u003e\n    v.weight \u003c w.weight\n      ? `${w.name} heavier then ${v.name}`\n      : `${v.name} heavier then ${w.name}`,\n  ),\n  or((e) =\u003e yep(`recovered err: ${e.message}`)),\n);\n\nprogram.then(console.log);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanstuemmel%2Fyep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjanstuemmel%2Fyep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjanstuemmel%2Fyep/lists"}