{"id":13740090,"url":"https://github.com/haskellcamargo/babel-plugin-implicit-function","last_synced_at":"2025-04-12T15:31:42.500Z","repository":{"id":82686708,"uuid":"101961251","full_name":"haskellcamargo/babel-plugin-implicit-function","owner":"haskellcamargo","description":"Babel plugin to allow lazy expressions by implicit arrow functions via ~ operator","archived":false,"fork":false,"pushed_at":"2017-09-04T03:43:48.000Z","size":21,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-25T09:01:30.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/haskellcamargo.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":"2017-08-31T05:03:26.000Z","updated_at":"2024-08-03T04:07:06.502Z","dependencies_parsed_at":"2023-07-25T08:30:44.464Z","dependency_job_id":null,"html_url":"https://github.com/haskellcamargo/babel-plugin-implicit-function","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"d92359387ce592af0c32ba9a27d5a84532b92b70"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskellcamargo%2Fbabel-plugin-implicit-function","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskellcamargo%2Fbabel-plugin-implicit-function/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskellcamargo%2Fbabel-plugin-implicit-function/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskellcamargo%2Fbabel-plugin-implicit-function/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haskellcamargo","download_url":"https://codeload.github.com/haskellcamargo/babel-plugin-implicit-function/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248589611,"owners_count":21129645,"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-03T04:00:42.388Z","updated_at":"2025-04-12T15:31:42.168Z","avatar_url":"https://github.com/haskellcamargo.png","language":"JavaScript","funding_links":[],"categories":["Plugins"],"sub_categories":["Syntax Sugar"],"readme":"# babel-plugin-implicit-function\n\nThis plugin is made to make JS syntax easier to work with functional programming by creating\nquoted expressions that may be lazily evaluated and work together with functional libraries,\nlike Ramda. I've overloaded the `~` prefix unary operator for that.\n\n## Examples\n\n```javascript\nimport { cond } from 'ramda';\n\nconst precomputedResult = ~(10 === 20);\nconst otherwise = ~true;\nconst matches = cond([\n    [precomputedResult, ~'Something is reeeeally wrong!'],\n    [otherwise, ~'Nice! Math still works!']\n]);\n```\n\nTurn into\n\n```javascript\nimport { cond } from 'ramda';\n\nconst precomputedResult = () =\u003e 10 === 20;\nconst otherwise = () =\u003e true;\nconst matches = cond([\n    [precomputedResult, () =\u003e 'Something is reeeeally wrong!'],\n    [otherwise, () =\u003e 'Nice! Math still works!']\n]);\n```\n\nThis is a good replacement for `always` function, because this is really lazy, and the value\nonly gets computed when you need it. Using `always` can cause problems by premature evaluation:\n\n```javascript\ngetUsers()\n    .then(always(doSomethingImportantAndReturn());\n```\n\nNote that `doSomethingImportantAndReturn` needs `getUsers` to be computed before, but that's\nnot what happen, and this is a source of error and code smell. We could easily fix that with\n`~` operator. Remember: **never** use `always`!\n\n```javascript\ngetUsers()\n    .then(~doSomethingImportantAndReturn());\n```\n\n\n## Disabling in current scope\n\nIf you want to use the original bitwise negation operator, you can disable this plugin in\ncurrent scope (and it children scopes) using `'no implicit function'` directive.\n\n## Installation\n\n```sh\n$ npm install --save-dev babel-plugin-implicit-function\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"implicit-function\"]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins implicit-function script.js\n```\n\n### Via Node API\n\n```javascript\nrequire('babel-core').transform('code', {\n  plugins: ['implicit-function']\n});\n```\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskellcamargo%2Fbabel-plugin-implicit-function","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaskellcamargo%2Fbabel-plugin-implicit-function","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskellcamargo%2Fbabel-plugin-implicit-function/lists"}