https://github.com/infinitybotlist/gostd.js
(Parts of the) GO stdlib in javascript
https://github.com/infinitybotlist/gostd.js
Last synced: about 1 year ago
JSON representation
(Parts of the) GO stdlib in javascript
- Host: GitHub
- URL: https://github.com/infinitybotlist/gostd.js
- Owner: InfinityBotList
- Created: 2023-11-10T10:52:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-05T11:25:53.000Z (about 2 years ago)
- Last Synced: 2025-02-17T11:31:41.947Z (over 1 year ago)
- Language: TypeScript
- Size: 1.19 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Gostd
Gostd is a port of the unique parts Go standard library to JavaScript.
Note that this is a work in progress and is not ready for production use. Also note that this is not a complete port of the Go standard library, only the parts that are unique to Go and do not have easily available or as high-quality alternatives in JavaScript.
## Ported Packages
- `io` (excluding `Pipe` which is TODO)
- `bufio` (only `Reader`)
- `bytes` (only `IndexByte()` and `Clone()` that is needed for bufio, for all sakes and purposes, unimplemented)
- `compress/lzw` (only reading support. Writing support is a planned TODO)
- `sync` (only `Mutex` and `RWMutex`)
## Go porting rules
- `panic` = `throw new Error()`
- `byte` = `number`
- `[]byte` = `[]number` or `Uint8Array`
- `make([]byte, n)` = `new Uint8Array(n)`
- `copy([]byte)` = `uint8Copy`
- `[]byte(string)` = `bytesFromString`
- `array[i:]` = `array.subarray(i)`
- `array[:j]` = `array.subarray(0, j)`
- `array[i:j]` = `array.subarray(i, j)`
- `(1<<63)-1` = `Number.MAX_SAFE_INTEGER` (JS doesnt support numbers larger than this)
### Limitations
- Single-threaded (equivalent to `GOMAXPROCS=1`)