Skip to content

Commit 3bd5c12

Browse files
dkirchhofzth
andauthored
add doc strings for json module (#75)
* add doc strings for json module * changed type of the reviver function * add @raises annotation also in res file * remove parseToAnyExn and parseToAnyExnWithReviver * change type of replacer * add stringifyWithFilter functions * fix formatting * fix wording * remove JSON.Encode.any and changed JSON.parseExnWithReviver accordingly * examples: change Js.Exn to Exn, remove whitespace in comment * add exceptions block to functions which will throw errors * Update src/Core__JSON.resi Co-authored-by: Gabriel Nordeborn <[email protected]> * Update src/Core__JSON.resi Co-authored-by: Gabriel Nordeborn <[email protected]> * Update src/Core__JSON.resi Co-authored-by: Gabriel Nordeborn <[email protected]> * Update src/Core__JSON.resi Co-authored-by: Gabriel Nordeborn <[email protected]> * Update src/Core__JSON.resi Co-authored-by: Gabriel Nordeborn <[email protected]> * Update src/Core__JSON.resi Co-authored-by: Gabriel Nordeborn <[email protected]> * Update src/Core__JSON.resi Co-authored-by: Gabriel Nordeborn <[email protected]> * fix: change Exn.Error to Exn.t --------- Co-authored-by: Gabriel Nordeborn <[email protected]>
1 parent a935975 commit 3bd5c12

File tree

2 files changed

+651
-32
lines changed

2 files changed

+651
-32
lines changed

src/Core__JSON.res

+15-17
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
type t = Js.Json.t
22

3-
type jsonReviver
4-
external asJsonReviver: 'a => jsonReviver = "%identity"
5-
type jsonReplacer
6-
external asJsonReplacer: 'a => jsonReplacer = "%identity"
7-
8-
@val external parseExn: string => t = "JSON.parse"
9-
@val external parseExnWithReviver: (string, jsonReviver) => t = "JSON.parse"
3+
@raises @val external parseExn: string => t = "JSON.parse"
4+
@raises @val external parseExnWithReviver: (string, (string, t) => t) => t = "JSON.parse"
105
@val external stringify: t => string = "JSON.stringify"
116
@val external stringifyWithIndent: (t, @as(json`null`) _, int) => string = "JSON.stringify"
12-
@val external stringifyWithReplacer: (t, jsonReplacer) => string = "JSON.stringify"
13-
@val external stringifyWithReplacerAndIndent: (t, jsonReplacer, int) => string = "JSON.stringify"
14-
15-
@val external parseToAnyExn: string => 'a = "JSON.parse"
16-
@val external parseToAnyExnWithReviver: (string, jsonReviver) => 'a = "JSON.parse"
17-
@val external stringifyAny: 'a => option<string> = "JSON.stringify"
7+
@val external stringifyWithReplacer: (t, (string, t) => t) => string = "JSON.stringify"
188
@val
9+
external stringifyWithReplacerAndIndent: (t, (string, t) => t, int) => string = "JSON.stringify"
10+
@val external stringifyWithFilter: (t, array<string>) => string = "JSON.stringify"
11+
@val external stringifyWithFilterAndIndent: (t, array<string>, int) => string = "JSON.stringify"
12+
@raises @val external stringifyAny: 'a => option<string> = "JSON.stringify"
13+
@raises @val
1914
external stringifyAnyWithIndent: ('a, @as(json`null`) _, int) => option<string> = "JSON.stringify"
20-
@val
21-
external stringifyAnyWithReplacer: ('a, jsonReplacer) => option<string> = "JSON.stringify"
22-
@val
23-
external stringifyAnyWithReplacerAndIndent: ('a, jsonReplacer, int) => option<string> =
15+
@raises @val
16+
external stringifyAnyWithReplacer: ('a, (string, t) => t) => option<string> = "JSON.stringify"
17+
@raises @val
18+
external stringifyAnyWithReplacerAndIndent: ('a, (string, t) => t, int) => option<string> =
2419
"JSON.stringify"
20+
@raises @val external stringifyAnyWithFilter: ('a, array<string>) => string = "JSON.stringify"
21+
@raises @val
22+
external stringifyAnyWithFilterAndIndent: ('a, array<string>, int) => string = "JSON.stringify"
2523

2624
module Classify = {
2725
type t =

0 commit comments

Comments
 (0)