{"id":17713737,"url":"https://github.com/duart38/carpenter","last_synced_at":"2025-04-21T04:31:08.279Z","repository":{"id":53766769,"uuid":"347924868","full_name":"duart38/Carpenter","owner":"duart38","description":"Method chaining pattern for all things Deno","archived":false,"fork":false,"pushed_at":"2021-03-17T13:32:02.000Z","size":102,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T16:59:19.951Z","etag":null,"topics":["builder-pattern","carpenter","chainable-methods","chaining","chaining-callables","deno","methodchain","string-carpenter"],"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/duart38.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["duart38"]}},"created_at":"2021-03-15T10:25:38.000Z","updated_at":"2023-07-09T05:01:18.000Z","dependencies_parsed_at":"2022-09-15T05:51:39.374Z","dependency_job_id":null,"html_url":"https://github.com/duart38/Carpenter","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duart38%2FCarpenter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duart38%2FCarpenter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duart38%2FCarpenter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duart38%2FCarpenter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duart38","download_url":"https://codeload.github.com/duart38/Carpenter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249996082,"owners_count":21358057,"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":["builder-pattern","carpenter","chainable-methods","chaining","chaining-callables","deno","methodchain","string-carpenter"],"created_at":"2024-10-25T10:22:22.183Z","updated_at":"2025-04-21T04:31:07.953Z","avatar_url":"https://github.com/duart38.png","language":"TypeScript","funding_links":["https://github.com/sponsors/duart38"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eCarpenter 🛠\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n\n\u003cimg src=\"https://img.shields.io/github/workflow/status/duart38/Carpenter/Test%20module?label=Tests\u0026style=for-the-badge\" /\u003e\n  \u003cimg src=\"https://img.shields.io/github/license/duart38/Carpenter?color=yellow\u0026style=for-the-badge\" /\u003e\n  \u003cimg src=\"https://img.shields.io/github/v/release/duart38/Carpenter?style=for-the-badge\" /\u003e\n\n\u003c/p\u003e\n\n\u003ca align=\"center\" href=\"https://doc.deno.land/https/deno.land/x/carpenter/mod.ts\"\u003e\n\nDocumentation\n\n\u003c/a\u003e\n\n## Road 🗺\n\n- [x] Add ARGS (deno.args) carpenter\n- [x] Add OS (deno.build) carpenter\n- [x] Add STRING carpenter\n- [x] Add ARRAY carpenter\n- [x] Add SWITCH carpenter\n- [x] Add OBJECT carpenter\n- [x] Add VALUE carpenter (unknown values)\n- [ ] Add more options to STRING carpenter\n- [ ] Add more interconnections between various carpenters\n\n## By example\n\n### OS specific code\n\n```JavaScript\nimport { OS } from \"./mod.ts\";\n\n// basic\nOS.on(\"darwin\").do(() =\u003e console.log(\"Hey Darwin\"));\nOS.on(\"darwin\").do(() =\u003e console.log(\"Hey Darwin\")).else(() =\u003e\n  console.log(\"something else\")\n);\n// multiple clauses\nlet str = \"\";\nOS.on(\"windows\")\n  .do(() =\u003e str += \"Hello \")\n  .do(() =\u003e str += \"world\");\n```\n\n---\n\n### Command line argument specific code\n\n```JavaScript\nimport {ARGS} from \"./mod.ts\";\n\n// basic usage\nARGS.on(\"-h\")\n    .do(() =\u003e some help code here)\n    .else(() =\u003e -h was not found);\n\n// multiple flags (evaluates when all flags are set)\nARGS.on(\"-x\", \"-a\")\n    .do(()=\u003e console.log(\"flag -x and -a was found together\"))\n```\n\n### Other carpenters\n\nFor more carpenters see documentation.\n\n```JavaScript\nimport { STRING } from \"./mod.ts\";\n\nSTRING(\"hello\")\n  .contains(\"hello\").and().contains(\"x\") // false\n  .or().isOfSize(5) // true\n  .do(() =\u003e console.log(\"OH WOW!!!!\")) // true because of OR operator\n;\n\nSTRING(\"hello\")\n  .adapt((prev: string) =\u003e prev += \" world\") // adapts the string.. you may continue with chaining after this\n  .getValue(); // gets the current object value.\n```\n\n```JavaScript\nimport { SWITCH } from \"./mod.ts\";\n\nSWITCH(someValue)\n  .case(\"one\").do(() =\u003e {})\n  .case(\"chain\")\n  .do(() =\u003e {})\n  .do(() =\u003e {})\n  .default(() =\u003e {});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduart38%2Fcarpenter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduart38%2Fcarpenter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduart38%2Fcarpenter/lists"}