@quenty/jsonutils 3.2.1-canary.8533eea.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +11 -4
- package/package.json +4 -4
- package/src/Shared/JSONUtils.lua +16 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [3.
|
|
6
|
+
## [3.3.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/jsonutils@3.3.0...@quenty/jsonutils@3.3.1) (2021-12-30)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @quenty/jsonutils
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [3.3.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/jsonutils@3.2.0...@quenty/jsonutils@3.3.0) (2021-12-18)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @quenty/jsonutils
|
|
9
17
|
|
package/README.md
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
## JSONUtils
|
|
2
2
|
<div align="center">
|
|
3
|
-
<a href="http://quenty.github.io/
|
|
4
|
-
<img src="https://
|
|
3
|
+
<a href="http://quenty.github.io/NevermoreEngine/">
|
|
4
|
+
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/docs.yml/badge.svg" alt="Documentation status" />
|
|
5
5
|
</a>
|
|
6
6
|
<a href="https://discord.gg/mhtGUS8">
|
|
7
|
-
<img src="https://img.shields.io/
|
|
7
|
+
<img src="https://img.shields.io/discord/385151591524597761?color=5865F2&label=discord&logo=discord&logoColor=white" alt="Discord" />
|
|
8
8
|
</a>
|
|
9
9
|
<a href="https://github.com/Quenty/NevermoreEngine/actions">
|
|
10
10
|
<img src="https://github.com/Quenty/NevermoreEngine/actions/workflows/build.yml/badge.svg" alt="Build and release status" />
|
|
11
11
|
</a>
|
|
12
12
|
</div>
|
|
13
13
|
|
|
14
|
-
Utility functions that wrap JSON functions in the HttpService.
|
|
14
|
+
Utility functions that wrap JSON functions in the HttpService.
|
|
15
|
+
|
|
16
|
+
<div align="center"><a href="https://quenty.github.io/NevermoreEngine/api/JSONUtils">View docs →</a></div>
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
```
|
|
20
|
+
npm install @quenty/jsonutils --save
|
|
21
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/jsonutils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "JSON utility functions for Roblox Lua",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"Quenty"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@quenty/loader": "3.1.
|
|
29
|
-
"@quenty/promise": "3.
|
|
28
|
+
"@quenty/loader": "^3.1.2",
|
|
29
|
+
"@quenty/promise": "^3.3.1"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "d146c77d0a8e452824de0ab0b4b03ba0370bcc1b"
|
|
35
35
|
}
|
package/src/Shared/JSONUtils.lua
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
--[=[
|
|
2
|
+
Utility methods for JSON
|
|
3
|
+
@class JSONUtils
|
|
4
|
+
]=]
|
|
3
5
|
|
|
4
6
|
local require = require(script.Parent.loader).load(script)
|
|
5
7
|
|
|
@@ -9,6 +11,13 @@ local Promise = require("Promise")
|
|
|
9
11
|
|
|
10
12
|
local JSONUtils = {}
|
|
11
13
|
|
|
14
|
+
--[=[
|
|
15
|
+
Decodes JSON, or reports error.
|
|
16
|
+
@param str string
|
|
17
|
+
@return boolean
|
|
18
|
+
@return table? -- Result
|
|
19
|
+
@return string? -- Error
|
|
20
|
+
]=]
|
|
12
21
|
function JSONUtils.jsonDecode(str)
|
|
13
22
|
if type(str) ~= "string" then
|
|
14
23
|
return false, nil, "Not a string"
|
|
@@ -25,6 +34,11 @@ function JSONUtils.jsonDecode(str)
|
|
|
25
34
|
return true, decoded
|
|
26
35
|
end
|
|
27
36
|
|
|
37
|
+
--[=[
|
|
38
|
+
Decodes JSON, or reports error.
|
|
39
|
+
@param str string
|
|
40
|
+
@return Promise<table>
|
|
41
|
+
]=]
|
|
28
42
|
function JSONUtils.promiseJSONDecode(str)
|
|
29
43
|
if type(str) ~= "string" then
|
|
30
44
|
return Promise.rejected("Not a string")
|