{"id":23070153,"url":"https://github.com/lamualfa/only-make","last_synced_at":"2025-08-15T13:32:43.189Z","repository":{"id":268258371,"uuid":"903679053","full_name":"lamualfa/only-make","owner":"lamualfa","description":"✨ One-liner helper to initialize complex local dependent variable.","archived":false,"fork":false,"pushed_at":"2024-12-15T15:18:53.000Z","size":3,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-15T16:27:07.943Z","etag":null,"topics":["make","only"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lamualfa.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-12-15T09:08:15.000Z","updated_at":"2024-12-15T15:16:45.000Z","dependencies_parsed_at":"2024-12-15T16:37:14.976Z","dependency_job_id":null,"html_url":"https://github.com/lamualfa/only-make","commit_stats":null,"previous_names":["lamualfa/only-make"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fonly-make","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fonly-make/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fonly-make/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamualfa%2Fonly-make/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamualfa","download_url":"https://codeload.github.com/lamualfa/only-make/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229916307,"owners_count":18144125,"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":["make","only"],"created_at":"2024-12-16T06:19:41.863Z","updated_at":"2024-12-16T06:19:42.503Z","avatar_url":"https://github.com/lamualfa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eonly-make\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e✨ One-liner helper to initialize complex local dependent variable.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/only-make\"\u003e\u003cimg src=\"https://img.shields.io/badge/v9.9.9-f00\" alt=\"NPM version\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/lamualfa/only-make/blob/main/license\"\u003e\u003cimg src=\"https://img.shields.io/badge/WTFPL-a020f0\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cblockquote align=\"center\"\u003eInspired by Rust's \u003ca href=\"https://doc.rust-lang.org/reference/expressions/block-expr.html\"\u003eBlock Expressions\u003c/a\u003e.\u003c/blockquote\u003e\n\n\u003cbr\u003e\n\n| Before                                                                                     | After                                                                                     |\n| ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |\n| ![before](https://github.com/user-attachments/assets/cf22a531-7a7f-4ec8-aba1-1ca93c6a465d) | ![after](https://github.com/user-attachments/assets/afeca08d-74e2-4abf-aa27-16ba4b702262) |\n\n\u003cbr\u003e\n\n![hr](https://user-images.githubusercontent.com/39755201/159233055-3bd55a37-7284-46ad-b759-5ab0c13b3828.png)\n\n## Features\n\n- 🔥 Zero dependencies\n- ⚡ Only 1 line of source code\n- 🚀 Supports on all Browser \u0026 Node.js versions\n- ✅ Fully typed\n\n## Installation\n\n```bash\nnpm install only-make\n```\n\n## Recipes\n\n- [Features](#features)\n- [Installation](#installation)\n- [Recipes](#recipes)\n  - [Basic](#basic)\n  - [Asynchronous](#asynchronous)\n  - [Golang Like Error Handling](#golang-like-error-handling)\n        - [Synchronously](#synchronously)\n        - [Asynchronously](#asynchronously)\n  - [Access `this`](#access-this)\n\n### Basic\n\n```js\nimport { make } from 'only-make'\n\nconst value = make(() =\u003e {\n  // Make \u0026 return the value\n})\n```\n\n### Asynchronous\n\n```js\nimport { make } from 'only-make'\n\nconst value = await make(async () =\u003e {\n  // Make \u0026 return the value\n})\n```\n\n### Golang Like Error Handling\n\n###### Synchronously\n\n```js\nimport { make } from 'only-make'\n\nconst [value, error] = make(() =\u003e {\n  // If success\n  return [new_value, null]\n\n  // If error\n  return [null, new_error]\n})\n\nif (!error) {\n  // Handle `error`\n}\n\n// Use `value` safely\n```\n\n###### Asynchronously\n\n```js\nimport { make } from 'only-make'\n\nconst [value, error] = await make(async () =\u003e {\n  // If success\n  return [new_value, null]\n\n  // If error\n  return [null, new_error]\n})\n\nif (!error) {\n  // Handle `error`\n}\n\n// Use `value` safely\n```\n\n### Access `this`\n\n```js\nimport { make } from 'only-make'\n\nclass MyClass {\n  doSomething() {\n    const value = make(() =\u003e {\n      // Use `this`\n    })\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamualfa%2Fonly-make","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamualfa%2Fonly-make","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamualfa%2Fonly-make/lists"}