{"id":17045438,"url":"https://github.com/ballercat/wasm-types","last_synced_at":"2025-04-12T15:32:11.537Z","repository":{"id":141203578,"uuid":"99291068","full_name":"ballercat/wasm-types","owner":"ballercat","description":"WebAssembly Types :hammer:","archived":false,"fork":false,"pushed_at":"2017-08-11T13:19:14.000Z","size":6,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T10:02:33.708Z","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/ballercat.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-04T01:45:46.000Z","updated_at":"2022-11-13T09:52:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fee405a-80c5-4eee-aad2-af93a3957b4c","html_url":"https://github.com/ballercat/wasm-types","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ballercat%2Fwasm-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ballercat%2Fwasm-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ballercat%2Fwasm-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ballercat%2Fwasm-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ballercat","download_url":"https://codeload.github.com/ballercat/wasm-types/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248589427,"owners_count":21129611,"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-10-14T09:37:25.328Z","updated_at":"2025-04-12T15:32:11.513Z","avatar_url":"https://github.com/ballercat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebAssembly Type Definitions\n\nType definitions of wasm types and some C types for use in JavaScript.\n\n```\nnpm install wasm-types\n```\n\n## 'Native' WebAssembly Types\n\n```javascript\n// Number types\ni32, i64, f32, f64\n```\n\nExtras. You _should_ be able to pass around anyfunc in WebAssembly, not sure about the other two but they are there if you need it.\n```\nanyfunc\nfunc\nblock_type\n```\n## Utility sizes\n\nThe following types are of sizes you can load/set in WebAssembly but are not **types**. _See https://github.com/WebAssembly/spec/tree/master/interpreter#s-expression-syntax_\n```\ni8, u8, i16, u16, u32\n// u64 is special\nu64\n```\n\n`u64` is not something you can set read in raw WebAssembly but something you can set into memory from JavaScript\n\n## sizeof\n\nThis module also exports a `sizeof` lookup Object for convenience.\n\n```javascript\n// In _bytes_\nconst word = 4;\n\nconst sizeof = {\n  [i32]: word,\n  [i64]: word * 2,\n  [f32]: word,\n  [f64]: word * 2,\n  [u32]: word,\n  [u16]: word \u003e\u003e 1,\n  [u8]: word \u003e\u003e 2,\n  [i8]: word \u003e\u003e 2,\n  [i16]: word \u003e\u003e 1,\n  [anyfunc]: word,\n  [func]: word,\n  [block_type]: word\n};\n```\n\n## Helpers API\n\nBetter with [curry](https://en.wikipedia.org/wiki/Currying).\n\n### wasmTypes.get(type, index, dataView) -\u003e number\n\nGet a value at `index` of `type` from `DataView`.\n\n### wasmTypes.set(type, index, dataView, value) -\u003e void\n\nSet a value at `index` of `type` in `DataView` with `value`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fballercat%2Fwasm-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fballercat%2Fwasm-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fballercat%2Fwasm-types/lists"}