{"id":18913361,"url":"https://github.com/erlang-punch/bertjs","last_synced_at":"2026-05-18T19:02:08.018Z","repository":{"id":200107962,"uuid":"704583157","full_name":"erlang-punch/bertjs","owner":"erlang-punch","description":"A production ready implementation of BERT/ETF in Javascript (inspired by BERT-JS)","archived":false,"fork":false,"pushed_at":"2023-10-15T09:42:10.000Z","size":23,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-31T14:22:26.692Z","etag":null,"topics":["bert","erlang","erlangtermformat","etf","javascript","serializer"],"latest_commit_sha":null,"homepage":"https://github.com/erlang-punch/bertjs","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/erlang-punch.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}},"created_at":"2023-10-13T15:12:26.000Z","updated_at":"2023-10-14T07:56:26.000Z","dependencies_parsed_at":"2023-10-15T19:53:50.604Z","dependency_job_id":null,"html_url":"https://github.com/erlang-punch/bertjs","commit_stats":null,"previous_names":["erlang-punch/bertjs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlang-punch%2Fbertjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlang-punch%2Fbertjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlang-punch%2Fbertjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erlang-punch%2Fbertjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erlang-punch","download_url":"https://codeload.github.com/erlang-punch/bertjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239907234,"owners_count":19716583,"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":["bert","erlang","erlangtermformat","etf","javascript","serializer"],"created_at":"2024-11-08T10:06:54.094Z","updated_at":"2025-10-13T14:06:16.287Z","avatar_url":"https://github.com/erlang-punch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bertjs\n\n![Erlang Punch Bertjs License](https://img.shields.io/github/license/erlang-punch/bertjs)\n![Erlang Punch Bertjs Top Language](https://img.shields.io/github/languages/top/erlang-punch/bertjs)\n![Erlang Punch Bertjs Workflow Status (main branch)](https://img.shields.io/github/actions/workflow/status/erlang-punch/bertjs/test.yaml?branch=main)\n![Erlang Punch Bertjs Last Commit](https://img.shields.io/github/last-commit/erlang-punch/bertjs)\n![Erlang Punch Bertjs Code Size (bytes)](https://img.shields.io/github/languages/code-size/erlang-punch/bertjs)\n![Erlang Punch Bertjs Repository File Count](https://img.shields.io/github/directory-file-count/erlang-punch/bertjs)\n![Erlang Punch Bertjs Repository Size](https://img.shields.io/github/repo-size/erlang-punch/bertjs)\n\nA production ready implementation of BERT/ETF in Javascript (inspired\nby BERT-JS).\n\n## Usage\n\n`node-repl` is installed and functions exported (or not) can be used\nwith node shell.\n\n```sh\nnpm run repl\n```\n\n### Decoding\n\n```javascript\n// atom support\n\"test\" === decode([131,100,0,4,116,101,115,116])\n\n// erlang string support\n\"test\" === decode([131,107,0,4,116,101,115,116])\n\n// binary support\nUint8Array(4) [ 116, 101, 115, 116 ] === decode([131,109,0,0,0,4,116,101,115,116])\n\n// list support\n[[],[[],[]]] === decode([131,108,0,0,0,2,106,108,0,0,0,2,106,106,106,106])\n```\n\n### Encoding\n\n```javascript\n```\n\n## Testing\n\n```sh\nnpm test\n```\n\n## Type Mapping\n\nThe goal of this implementation is to offer a 1:1 mapping between\nErlang terms and Javascript types. A client SHOULD NOT have the\npossility to create atoms (except for `null`, `true` and `false`) or\nspecial terms but a server CAN send atoms or specials terms. In fact,\nspecial terms SHOULD raise an exception on the client side, but atoms\nSHOULD BE converted to String.\n\n| erlang term           | to | javascript type | comment |\n|-----------------------|----|-----------------|---------|\n| `ATOM_EXT`            |    | `String`         | \n| `ATOM_UTF8_EXT`       |    | `String`         |\n| `SMALL_ATOM_EXT`      |    | `String`         |\n| `SMALL_ATOM_UTF8_EXT` |    | `String`         |\n| `BINARY_EXT`          |    | `ArrayBuffer`    |\n| `BIT_BINARY_EXT`      |    | `ArrayBuffer`    |\n| `SMALL_INTEGER_EXT`   |    | `Number`         |\n| `INTEGER_EXT`         |    | `Number`         |\n| `LARGE_BIG_EXT`       |    | `Number`         |\n| `SMALL_BIG_EXT`       |    | `Number`         |\n| `FLOAT_EXT`           |    | `Number`         |\n| `NEW_FLOAT_EXT`       |    | `Number`         |\n| `STRING_EXT`          |    | `String`         |\n| `LIST_EXT`            |    | `Array`          |\n| `NIL_EXT`             |    | `Array`          | \n| `SMALL_TUPLE_EXT`     |    | `Map`            |\n| `LARGE_TUPLE_EXT`     |    | `Map`            |\n| `MAP_EXT`             |    | `Map`            |\n\n\n| javascript type  | to | erlang term    | comments\n|------------------|----|-----------------|---------|\n| `Null`           |    | `ATOM_EXT`      | encoded as `nil`\n| `String`         |    | `STRING_EXT`    | or binary_ext (depending of the content)\n| `ArrayBuffer`    |    | `BINARY_EXT`    | -\n| `Boolean`        |    | `ATOM_EXT`      | encoded as `true` or `false`\n| `Map`            |    | `MAP_EXT`       |\n| `Set`            |    | `LIST_EXT`      |\n| `ArrayBuffer`    |    | `BINARY_EXT`    |\n| `Array`          |    | `LIST_EXT`      |\n| `Number`         |    | `NEW_FLOAT_EXT` |\n| `Int8`           |    | `SMALL_INTEGER` | when 0 =\u003c Int =\u003c 255 \n| `Int16`          |    | `INTEGER_EXT`   |\n| `Int32`          |    | `INTEGER_EXT`   |\n| `BigInt`         |    | `LARGE_BIG_EXT` |\n| `Float`          |    | `NEW_FLOAT_EXT` |\n| `Float32`        |    | `NEW_FLOAT_EXT` |\n| `Float64`        |    | `NEW_FLOAT_EXT` |\n\n\n## References and Resources\n\n - [`Null`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/null)\n - [`Boolean`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)\n - [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)\n - [`BigInt`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)\n - [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)\n - [`Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)\n - [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)\n - [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map)\n - [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap)\n - [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferlang-punch%2Fbertjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferlang-punch%2Fbertjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferlang-punch%2Fbertjs/lists"}