{"id":18367145,"url":"https://github.com/amoutonbrady/baracuda","last_synced_at":"2026-03-10T15:04:02.521Z","repository":{"id":38549995,"uuid":"233390024","full_name":"amoutonbrady/baracuda","owner":"amoutonbrady","description":"An alternative to JSX that works with Hyperscript view functions","archived":false,"fork":false,"pushed_at":"2025-02-10T20:35:16.000Z","size":108,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-22T13:38:25.639Z","etag":null,"topics":["dom","h","helper","hyperapp","hyperscript","proxy"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/amoutonbrady.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-12T12:36:29.000Z","updated_at":"2025-02-21T22:04:03.000Z","dependencies_parsed_at":"2025-04-06T16:33:08.264Z","dependency_job_id":"0f6f0a7e-9eb3-4e23-a657-61643b723aae","html_url":"https://github.com/amoutonbrady/baracuda","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/amoutonbrady/baracuda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoutonbrady%2Fbaracuda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoutonbrady%2Fbaracuda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoutonbrady%2Fbaracuda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoutonbrady%2Fbaracuda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amoutonbrady","download_url":"https://codeload.github.com/amoutonbrady/baracuda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amoutonbrady%2Fbaracuda/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261676371,"owners_count":23192778,"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":["dom","h","helper","hyperapp","hyperscript","proxy"],"created_at":"2024-11-05T23:20:13.837Z","updated_at":"2026-03-10T15:03:57.497Z","avatar_url":"https://github.com/amoutonbrady.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![codecov](https://codecov.io/gh/amoutonbrady/baracuda/branch/master/graph/badge.svg)](https://codecov.io/gh/amoutonbrady/baracuda)\n\n# Baracuda\n\nA tiny (400B), modern and fast utility around [hyperscript](https://github.com/hyperhype/hyperscript) like view layer\n\n## Why?\n\nMostly code readability and DX. `h1('Hello world')` is easier to understand (for me that is) than `h('h1', {}, 'Hello world')`. It comes in handy when you have nested childrens.\n\n```js\nul([li('First item'), li('Second item')]);\n```\n\nThere was [other](https://github.com/ohanhi/hyperscript-helpers) [options](https://github.com/ungoldman/hyperaxe) but they seemed a little on the heavy side. I wanted something modern and slick.\n\n## How?\n\n[Proxy](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy).\n\n## Installation\n\n```bash\nnpm install @amoutonbrady/baracuda\nor\nyarn add @amoutonbrady/baracuda\n```\n\n## Usage\n\nImport the `baracuda` factory function and wrap it around an `hyperscript` like function.\n\nAccording to tests, `baracuda` should be _at least_ compatible with the following frameworks:\n\n-   Vue 3: `import { h } from 'vue'`\n-   Hyperapp: `import { h } from 'hyperapp'`\n-   Preact: `import { h } from 'preact'`\n-   Inferno: `import { h } from 'inferno-hyperscript'`\n-   Redom: `import { el } from 'redom'`\n\nYou can find more example in the `tests` directory\n\nThe `hyperscript` like function has to take **3 arguments** :\n\n```ts\nh(tag: string, attributes: Object, childrens: string | Element | Element[])\n```\n\nThe return object from `baracuda` is a Proxy that can be destructed into functions with the following interface:\n\n```ts\nfn(attributes: Object, childrens: string | Element | Element[]): Element\nfn(childrens: string | Element | Element[]): Element\n```\n\nWhere:\n\n-   `fn` is the name of the tag (eg: `div`, `h1`, etc.)\n-   `attributes` is an object containing dom attributes (eg: classes, event handler, etc.)\n-   `childrens` is either a string or an array of `Element`\n\n⚠️ If the first argument is **not** an object, it will be interpreted as the `childrens` argument and defaulting the `attributes` to `{}`\n\n## Example\n\n_note: the library exports a default function as well as a named function_\n\n#### Quick example\n\n```\nimport { h, render } from 'my-dom-library';\nimport { baracuda } from '@amoutonbrady/baracuda';\n// import hh from '@amoutonbrady/baracuda'; \u003c= That also works\n\nconst { ul, li } = baracuda(h);\n\nconst app = ul([\n    li(1),\n    li(2),\n]);\n\nrender(app, document.body);\n```\n\n#### Live example\n\n-   [Adapting the official Hyperapp V2 example using Baracuda](https://codesandbox.io/s/hyperapp-baracuda-example-e5ful)\n\n## Limitations\n\nThis utility is based on an non polyfillable feature: Proxy. This can't be used in a non evergreen browser.\n\nSee [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#Browser_compatibility) for the full compatibility list. I only use the `handler.get` feature.\n\nMithril is only partially compatible for the moment.\n\n## Contributing\n\n```bash\ngit clone https://github.com/amoutonbrady/baracuda\n\ncd baracuda\n\nyarn install\n\nyarn build\n\nyarn test\n```\n\n## Roadmap\n\n-   [x] ~Typescript support~ Better Typescript support\n-   [ ] Add helpers, like classes, id\n-   [ ] More tests\n\n## Aknowledgment\n\n-   [This issue](https://github.com/ohanhi/hyperscript-helpers/issues/26) started it all\n-   [Hyperapp](https://github.com/jorgebucaran/hyperapp) which is the framework I had in mind while prototyping this\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famoutonbrady%2Fbaracuda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famoutonbrady%2Fbaracuda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famoutonbrady%2Fbaracuda/lists"}