Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/beenotung/bon
stackish based decode and encode library in Erlang and Typescript
https://github.com/beenotung/bon
erlang library stackish
Last synced: 9 days ago
JSON representation
stackish based decode and encode library in Erlang and Typescript
- Host: GitHub
- URL: https://github.com/beenotung/bon
- Owner: beenotung
- Created: 2017-10-24T14:20:47.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-09T12:55:15.000Z (6 months ago)
- Last Synced: 2024-07-09T16:25:33.259Z (6 months ago)
- Topics: erlang, library, stackish
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/@beenotung/bon
- Size: 105 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.asciidoc
Awesome Lists containing this project
README
= BON =
image:https://secure.travis-ci.org/beenotung/bon.png?branch=master[Build Status,link=http://travis-ci.org/beenotung/bon]
image:https://img.shields.io/npm/v/@beenotung/bon.svg?maxAge=2592000[npm Package Version,link=https://www.npmjs.com/package/@beenotung/bon]Binary Object Notation,
A.K.A. Beeno Object NotationBased on stackish.
Available as a https://www.npmjs.org/package/@beenotung/bon[npm package at @beenotung/bon].
== Introduction ==
This protocol and library is designed to enable loss-less data exchange between Erlang to Javascript.
Loss-less means it will not mess up tuple and list, nor atom and hashmap key
* Integer is represented in dec format, e.g. 42
* Floating number is represented in rational format (of integer), e.g. 314/100
== Remark ==
(For ideal performance, consider to use https://github.com/beenotung/erlang_js[@beenotung/erlang_js] which use Erlang External Term Format directly)
== The Mapping between Erlang term, BON and Javascript term ==
.Data Type Mapping Table
[options="header"]
|=========================================
| Erlang | BON | Javascript| integer | integer | number
| float | rational number | number
| atom | atom blob | Symbol
| binary | binary blob | Uint8Array
| tuple | tuple group | Tuple
| list | list group | List / Array
| char_list | string | string
| map | map group | Map / object
| set | set group | Set
|=========================================== Examples ==
.BON data type representation
|==============================
| Data Type | BON Example| integer | 42
| rational number | 157/50
| atom blob | 'a:3:foo'
| binary blob | 'b:4:text'
| tuple group | [ 3 2 1 t
| list group | [ 3 2 1 l
| string | "foo"
| map group | [ "admin" "user" "123" "pw" m
| set group | [ 42 3.14 "str" s
|================================ TODO ==
. Migrate the repo from personal to [bon-org](https://github.com/bon-org)
- [x] move javascript/typescript package to [bon-js](https://github.com/bon-org/bon-js)
- [x] move erlang package to [bon-erl](https://github.com/bon-org/bon-erlang)
- [ ] update link to build status and npm package in readme
. Implement Golang library