{"id":21224263,"url":"https://github.com/sam-parsons/babel-plugin-transform-walrus-operator","last_synced_at":"2026-02-02T10:43:56.407Z","repository":{"id":42649568,"uuid":"347771106","full_name":"sam-parsons/babel-plugin-transform-walrus-operator","owner":"sam-parsons","description":"return a value from an assignment expression","archived":false,"fork":false,"pushed_at":"2022-03-29T22:10:23.000Z","size":237,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T02:21:04.549Z","etag":null,"topics":["babel","babel-plugin","walrus-operator"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/babel-plugin-transform-walrus-operator","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sam-parsons.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-14T22:35:02.000Z","updated_at":"2023-03-09T03:58:17.000Z","dependencies_parsed_at":"2022-08-31T01:01:20.072Z","dependency_job_id":null,"html_url":"https://github.com/sam-parsons/babel-plugin-transform-walrus-operator","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/sam-parsons/babel-plugin-transform-walrus-operator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-parsons%2Fbabel-plugin-transform-walrus-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-parsons%2Fbabel-plugin-transform-walrus-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-parsons%2Fbabel-plugin-transform-walrus-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-parsons%2Fbabel-plugin-transform-walrus-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sam-parsons","download_url":"https://codeload.github.com/sam-parsons/babel-plugin-transform-walrus-operator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sam-parsons%2Fbabel-plugin-transform-walrus-operator/sbom","scorecard":{"id":796908,"data":{"date":"2025-08-11","repo":{"name":"github.com/sam-parsons/babel-plugin-transform-walrus-operator","commit":"134b2ccf6c341b18b21ae00db162d3ff4cae11b6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/21 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 4 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"12 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T09:16:03.798Z","repository_id":42649568,"created_at":"2025-08-23T09:16:03.798Z","updated_at":"2025-08-23T09:16:03.798Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29010602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T10:37:29.253Z","status":"ssl_error","status_checked_at":"2026-02-02T10:37:28.644Z","response_time":58,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["babel","babel-plugin","walrus-operator"],"created_at":"2024-11-20T22:57:31.099Z","updated_at":"2026-02-02T10:43:56.378Z","avatar_url":"https://github.com/sam-parsons.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[npm]: https://img.shields.io/npm/v/babel-plugin-transform-walrus-operator\n[npm-url]: https://www.npmjs.com/package/babel-plugin-transform-walrus-operator\n[size]: https://packagephobia.now.sh/badge?p=babel-plugin-transform-walrus-operator\n[size-url]: https://packagephobia.now.sh/result?p=babel-plugin-transform-walrus-operator\n\n[![npm][npm]][npm-url]\n[![size][size]][size-url]\n[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com)\n\n\n# babel-plugin-transform-walrus-operator\n\n\u003e compile the walrus operator ```:=``` to an IIFE\n\n## About\n\n\u003ci\u003eassignment statement\u003c/i\u003e\n\n- assigns 42 to x\n- returns undefined\n\n```js\nx = 42;\n```\n\n\u003ci\u003eassignment expression\u003c/i\u003e\n\n- assigns 42 to x\n- returns 42\n\n```js\n(x := 42)\n```\n\n\u003chr\u003e\n\n#### \u003ci\u003eExample use case\u003c/i\u003e\n\n```js\ny = func(x);\nconst arr = [y, y ** 2, y ** 4, y ** 6];\n``` \ncan become\n```js\nconst arr = [y := func(x), y ** 2, y ** 4, y ** 6]\n``` \n\n\u003chr\u003e\n\n#### \u003ci\u003eTransformation\u003c/i\u003e\n\n```js\nif (x := 2) alert();\n```\ngenerally becomes\n```js\nif ((function (x) {\n  if (typeof x === 'undefined') throw new Error();\n  x = 2;\n  return x;\n})(x)) alert();\n```\n\n## Babel Setup\n\nthis plugin relies upon the ```:=``` token, it will have to be manually added to babel's parser\n\nfollow \u003ca href=\"https://lihautan.com/creating-custom-javascript-syntax-with-babel/#fork-the-babel\"\u003eTan Li Hau's guide,\u003c/a\u003e you will fork babel and add a token to the parser.  see my \u003ca href=\"https://github.com/sam-parsons/babel/commit/b28c29c7d9d1bd1d518ff53b68c7697ceb86cd1b\"\u003ebabel fork commit\u003c/a\u003e\n\n## Installation\n\n```sh\n$ npm install --save-dev babel-plugin-transform-walrus-operator\n```\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"transform-walrus-operator\"]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins transform-walrus-operator script.js\n```\n\n### Via Node API\n\n```javascript\nrequire('babel-core').transform('code', {\n  plugins: ['transform-walrus-operator'],\n});\n```\n\n# License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam-parsons%2Fbabel-plugin-transform-walrus-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsam-parsons%2Fbabel-plugin-transform-walrus-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsam-parsons%2Fbabel-plugin-transform-walrus-operator/lists"}