Skip to content

Commit 56fade8

Browse files
committed
improved function definitions
1 parent 8064e01 commit 56fade8

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

hjson.lua

+10-10
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ local encoderH = require "hjson.encoderH"
1111
---
1212
---decodes h/json
1313
---@param str string
14-
---@param strict boolean
15-
---@param object_hook fun(obj: table): table
16-
---@param object_pairs_hook fun(pairs: HjsonKeyValuePair[]): HjsonKeyValuePair[]
14+
---@param strict boolean?
15+
---@param object_hook (fun(obj: table): table)?
16+
---@param object_pairs_hook (fun(pairs: HjsonKeyValuePair[]): HjsonKeyValuePair[])?
1717
---@return any
1818
local function decode(str, strict, object_hook, object_pairs_hook)
1919
local _decoder = decoder:new(strict, object_hook, object_pairs_hook)
@@ -32,7 +32,7 @@ end
3232
---
3333
---encodes json
3434
---@param obj any
35-
---@param options HjsonEncodeOptions
35+
---@param options HjsonEncodeOptions?
3636
---@return any
3737
local function encode_json(obj, options)
3838
local _encoder = encoder:new(options)
@@ -43,7 +43,7 @@ end
4343
---
4444
---encodes hjson
4545
---@param obj any
46-
---@param options HjsonEncodeOptions
46+
---@param options HjsonEncodeOptions?
4747
---@return any
4848
local function encode(obj, options)
4949
if type(options) ~= "table" then
@@ -63,25 +63,25 @@ local hjson = {
6363
---
6464
---encodes hjson
6565
---@param obj any
66-
---@param options HjsonEncodeOptions
66+
---@param options HjsonEncodeOptions?
6767
---@return any
6868
stringify = encode,
6969
encode_to_json = encode_json,
7070
---#DES 'hjson.stringify_to_json'
7171
---
7272
---encodes json
7373
---@param obj any
74-
---@param options HjsonEncodeOptions
74+
---@param options HjsonEncodeOptions?
7575
---@return any
7676
stringify_to_json = encode_json,
7777
decode = decode,
7878
---#DES 'hjson.parse'
7979
---
8080
---decodes h/json
8181
---@param str string
82-
---@param strict boolean
83-
---@param object_hook fun(obj: table): table
84-
---@param object_pairs_hook fun(pairs: HjsonKeyValuePair[]): HjsonKeyValuePair[]
82+
---@param strict boolean?
83+
---@param object_hook (fun(obj: table): table)?
84+
---@param object_pairs_hook (fun(pairs: HjsonKeyValuePair[]): HjsonKeyValuePair[])?
8585
---@return any
8686
parse = decode
8787
}

0 commit comments

Comments
 (0)