mirror of
https://github.com/lune-org/lune.git
synced 2025-04-11 22:10:53 +01:00
feat(types): include and document json5 support in types
This commit is contained in:
parent
532409aa25
commit
e4c4ea4129
1 changed files with 8 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
export type EncodeDecodeFormat = "json" | "yaml" | "toml"
|
export type EncodeDecodeFormat = "json" | "json5" | "yaml" | "toml"
|
||||||
|
|
||||||
export type CompressDecompressFormat = "brotli" | "gzip" | "lz4" | "zlib"
|
export type CompressDecompressFormat = "brotli" | "gzip" | "lz4" | "zlib"
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ export type CompressDecompressFormat = "brotli" | "gzip" | "lz4" | "zlib"
|
||||||
|
|
||||||
-- Parse different file formats into lua tables
|
-- Parse different file formats into lua tables
|
||||||
local someJson = serde.decode("json", fs.readFile("myFile.json"))
|
local someJson = serde.decode("json", fs.readFile("myFile.json"))
|
||||||
|
local someJson5 = serde.decode("json5", fs.readFile("myFile.json5"))
|
||||||
local someToml = serde.decode("toml", fs.readFile("myFile.toml"))
|
local someToml = serde.decode("toml", fs.readFile("myFile.toml"))
|
||||||
local someYaml = serde.decode("yaml", fs.readFile("myFile.yaml"))
|
local someYaml = serde.decode("yaml", fs.readFile("myFile.yaml"))
|
||||||
|
|
||||||
|
@ -60,11 +61,12 @@ end
|
||||||
|
|
||||||
Currently supported formats:
|
Currently supported formats:
|
||||||
|
|
||||||
| Name | Learn More |
|
| Name | Learn More |
|
||||||
|:-------|:---------------------|
|
|:--------|:---------------------|
|
||||||
| `json` | https://www.json.org |
|
| `json` | https://www.json.org |
|
||||||
| `yaml` | https://yaml.org |
|
| `json5` | https://json5.org |
|
||||||
| `toml` | https://toml.io |
|
| `yaml` | https://yaml.org |
|
||||||
|
| `toml` | https://toml.io |
|
||||||
|
|
||||||
@param format The format to use
|
@param format The format to use
|
||||||
@param encoded The string to decode
|
@param encoded The string to decode
|
||||||
|
|
Loading…
Add table
Reference in a new issue