Adding b64 and json decoder and encoder functions (#829)

This commit is contained in:
Ghoulboy authored and GitHub committed 2021-04-26 21:21:35 -03:00
1 parent 28101e716b
commit 1bc2dd94da
4 files changed
+36

No files matched your search

@@ -267,6 +267,7 @@ but like everywhere else, doing that sounds like a bad idea.
- `io_exception`: This is the parent for any exception that occurs due to an error handling external data.
- `nbt_error`: Incorrect input/output NBT file.
- `json_error`: Incorrect input/output JSON data.
- `b64_error`: Incorrect input/output b64 (base 64) string
- `user_exception`: Exception thrown by default with `throw` function.
Synopsis:
@@ -146,3 +146,12 @@ it will be used from now on as a new value for the accumulator.
reduce([1,2,3,4],_a+_,0) => 10
reduce([1,2,3,4],_a*_,1) => 24
</pre>
### `encode_b64(string)`, `decode_b64(string)`
Encode or decode a string from b64, throwing a `b64_error` exception if it's invalid
### `encode_json(value)`, `decode_json(string)`
Encodes a value as a json string, and decodes a json string as a valid value, throwing a `json_error` exception if it
doesn't parse properly