@grain/stdlib 0.6.5 → 0.7.0
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 +64 -0
- package/LICENSE +1 -1
- package/README.md +2 -2
- package/array.gr +55 -7
- package/array.md +123 -77
- package/bigint.md +30 -30
- package/buffer.gr +20 -53
- package/buffer.md +47 -47
- package/bytes.gr +111 -35
- package/bytes.md +111 -32
- package/char.gr +201 -99
- package/char.md +361 -34
- package/exception.gr +11 -11
- package/exception.md +26 -1
- package/float32.gr +327 -3
- package/float32.md +606 -19
- package/float64.gr +320 -3
- package/float64.md +606 -19
- package/fs.gr +1082 -0
- package/fs.md +630 -0
- package/hash.gr +142 -88
- package/hash.md +102 -14
- package/int16.md +23 -23
- package/int32.gr +25 -4
- package/int32.md +65 -30
- package/int64.gr +26 -1
- package/int64.md +65 -30
- package/int8.md +23 -23
- package/json.gr +366 -51
- package/json.md +418 -2
- package/list.gr +387 -49
- package/list.md +492 -69
- package/map.gr +20 -12
- package/map.md +44 -38
- package/marshal.gr +41 -40
- package/marshal.md +2 -2
- package/number.gr +159 -30
- package/number.md +215 -38
- package/option.md +21 -21
- package/package.json +5 -3
- package/path.gr +48 -0
- package/path.md +103 -12
- package/pervasives.gr +2 -2
- package/pervasives.md +37 -37
- package/priorityqueue.gr +7 -7
- package/priorityqueue.md +19 -19
- package/queue.gr +183 -29
- package/queue.md +296 -40
- package/random.md +6 -6
- package/range.gr +4 -4
- package/range.md +6 -6
- package/rational.md +16 -16
- package/regex.gr +52 -51
- package/regex.md +11 -11
- package/result.md +16 -16
- package/runtime/atof/common.md +39 -39
- package/runtime/atof/decimal.gr +6 -6
- package/runtime/atof/decimal.md +8 -8
- package/runtime/atof/lemire.gr +5 -5
- package/runtime/atof/lemire.md +1 -1
- package/runtime/atof/parse.gr +16 -16
- package/runtime/atof/parse.md +2 -2
- package/runtime/atof/slow.md +1 -1
- package/runtime/atof/table.md +2 -2
- package/runtime/atoi/parse.gr +3 -3
- package/runtime/atoi/parse.md +1 -1
- package/runtime/bigint.gr +15 -47
- package/runtime/bigint.md +54 -60
- package/runtime/compare.gr +2 -2
- package/runtime/compare.md +1 -1
- package/runtime/dataStructures.md +33 -33
- package/runtime/debugPrint.gr +4 -1
- package/runtime/debugPrint.md +9 -9
- package/runtime/equal.gr +99 -77
- package/runtime/equal.md +1 -1
- package/runtime/exception.gr +62 -82
- package/runtime/exception.md +62 -11
- package/runtime/gc.gr +39 -45
- package/runtime/gc.md +4 -4
- package/runtime/malloc.gr +7 -7
- package/runtime/malloc.md +4 -4
- package/runtime/math/kernel/cos.gr +70 -0
- package/runtime/math/kernel/cos.md +14 -0
- package/runtime/math/kernel/sin.gr +65 -0
- package/runtime/math/kernel/sin.md +14 -0
- package/runtime/math/kernel/tan.gr +136 -0
- package/runtime/math/kernel/tan.md +14 -0
- package/runtime/math/rempio2.gr +244 -0
- package/runtime/math/rempio2.md +14 -0
- package/runtime/math/trig.gr +130 -0
- package/runtime/math/trig.md +28 -0
- package/runtime/math/umuldi.gr +26 -0
- package/runtime/math/umuldi.md +14 -0
- package/runtime/numberUtils.gr +29 -29
- package/runtime/numberUtils.md +12 -12
- package/runtime/numbers.gr +373 -381
- package/runtime/numbers.md +79 -73
- package/runtime/string.gr +37 -105
- package/runtime/string.md +3 -9
- package/runtime/unsafe/constants.md +24 -24
- package/runtime/unsafe/conv.md +13 -13
- package/runtime/unsafe/memory.gr +24 -20
- package/runtime/unsafe/memory.md +27 -7
- package/runtime/unsafe/offsets.gr +36 -0
- package/runtime/unsafe/offsets.md +88 -0
- package/runtime/unsafe/panic.gr +28 -0
- package/runtime/unsafe/panic.md +14 -0
- package/runtime/unsafe/tags.md +32 -32
- package/runtime/unsafe/wasmf32.md +28 -28
- package/runtime/unsafe/wasmf64.md +28 -28
- package/runtime/unsafe/wasmi32.md +47 -47
- package/runtime/unsafe/wasmi64.md +50 -50
- package/runtime/utf8.gr +189 -0
- package/runtime/utf8.md +117 -0
- package/runtime/wasi.gr +4 -2
- package/runtime/wasi.md +138 -138
- package/set.gr +18 -11
- package/set.md +42 -36
- package/stack.gr +171 -2
- package/stack.md +297 -15
- package/string.gr +352 -557
- package/string.md +77 -34
- package/uint16.gr +81 -0
- package/uint16.md +183 -22
- package/uint32.gr +25 -4
- package/uint32.md +63 -28
- package/uint64.gr +25 -5
- package/uint64.md +63 -28
- package/uint8.gr +81 -0
- package/uint8.md +183 -22
- package/uri.gr +57 -53
- package/uri.md +11 -12
- package/wasi/file.gr +67 -59
- package/wasi/file.md +39 -39
- package/wasi/process.md +5 -5
- package/wasi/random.md +3 -3
- package/wasi/time.md +4 -4
- package/runtime/utils/printing.gr +0 -60
- package/runtime/utils/printing.md +0 -26
package/uri.gr
CHANGED
|
@@ -82,18 +82,18 @@ provide enum EncodeSet {
|
|
|
82
82
|
|
|
83
83
|
let isHexDigit = char => {
|
|
84
84
|
use Char.{ (<=), (>=) }
|
|
85
|
-
Char.
|
|
86
|
-
char >= 'A' && char <= 'F'
|
|
87
|
-
char >= 'a' && char <= 'f'
|
|
85
|
+
Char.Ascii.isDigit(char)
|
|
86
|
+
|| char >= 'A' && char <= 'F'
|
|
87
|
+
|| char >= 'a' && char <= 'f'
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
let isUnreservedChar = char => {
|
|
91
|
-
Char.
|
|
92
|
-
Char.
|
|
93
|
-
char == '-'
|
|
94
|
-
char == '.'
|
|
95
|
-
char == '_'
|
|
96
|
-
char == '~'
|
|
91
|
+
Char.Ascii.isDigit(char)
|
|
92
|
+
|| Char.Ascii.isAlpha(char)
|
|
93
|
+
|| char == '-'
|
|
94
|
+
|| char == '.'
|
|
95
|
+
|| char == '_'
|
|
96
|
+
|| char == '~'
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
let isSubDelim = char => {
|
|
@@ -142,10 +142,10 @@ let makeEncoder = (encodeSet: EncodeSet) => {
|
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
let charToHexValue = char => {
|
|
145
|
-
if (Char.
|
|
145
|
+
if (Char.Ascii.isDigit(char)) {
|
|
146
146
|
Char.code(char) - 0x30
|
|
147
147
|
} else {
|
|
148
|
-
let char = Char.
|
|
148
|
+
let char = Char.Ascii.toLowercase(char)
|
|
149
149
|
Char.code(char) - 0x60 + 9
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -173,8 +173,8 @@ let decodeValid = (str, onlyUnreserved=false) => {
|
|
|
173
173
|
let pctDecodedVal = charToHexValue(next) * 16 + charToHexValue(nextNext)
|
|
174
174
|
if (onlyUnreserved && !isUnreservedChar(Char.fromCode(pctDecodedVal))) {
|
|
175
175
|
Buffer.addChar('%', out)
|
|
176
|
-
Buffer.addChar(Char.
|
|
177
|
-
Buffer.addChar(Char.
|
|
176
|
+
Buffer.addChar(Char.Ascii.toUppercase(next), out)
|
|
177
|
+
Buffer.addChar(Char.Ascii.toUppercase(nextNext), out)
|
|
178
178
|
} else {
|
|
179
179
|
Buffer.addUint8(Uint8.fromNumber(pctDecodedVal), out)
|
|
180
180
|
}
|
|
@@ -189,8 +189,12 @@ let isValidEncoding = str => {
|
|
|
189
189
|
let len = Array.length(chars)
|
|
190
190
|
for (let mut i = 0; i < len; i += 1) {
|
|
191
191
|
if (
|
|
192
|
-
chars[i] == '%'
|
|
193
|
-
|
|
192
|
+
chars[i] == '%'
|
|
193
|
+
&& (
|
|
194
|
+
i >= len - 2
|
|
195
|
+
|| !isHexDigit(chars[i + 1])
|
|
196
|
+
|| !isHexDigit(chars[i + 2])
|
|
197
|
+
)
|
|
194
198
|
) {
|
|
195
199
|
return false
|
|
196
200
|
}
|
|
@@ -209,7 +213,7 @@ let normalizeHost = str => {
|
|
|
209
213
|
} else if (i >= 2 && chars[i - 2] == '%') {
|
|
210
214
|
getChars(i - 3, ['%', chars[i - 1], chars[i], ...acc])
|
|
211
215
|
} else {
|
|
212
|
-
getChars(i - 1, [Char.
|
|
216
|
+
getChars(i - 1, [Char.Ascii.toLowercase(chars[i]), ...acc])
|
|
213
217
|
}
|
|
214
218
|
}
|
|
215
219
|
let chars = getChars(String.length(str) - 1, [])
|
|
@@ -259,15 +263,15 @@ let removeDotSegments = path => {
|
|
|
259
263
|
|
|
260
264
|
/**
|
|
261
265
|
* Percent-encodes characters in a string based on the specified `EncodeSet`.
|
|
262
|
-
*
|
|
266
|
+
*
|
|
263
267
|
* @param str: The string to encode
|
|
264
268
|
* @param encodeSet: An indication for which characters to percent-encode. `EncodeNonUnreserved` by default
|
|
265
269
|
* @returns A percent-encoding of the given string
|
|
266
|
-
*
|
|
270
|
+
*
|
|
267
271
|
* @example Uri.encode("h3ll0_.w ?o+rld", encodeSet=Uri.EncodeNonUnreserved) // "h3ll0_.w%20%3Fo%2Brld"
|
|
268
272
|
* @example Uri.encode("d+om@i:n.com", encodeSet=Uri.EncodeRegisteredHost) // "d+om%40i%3An.com"
|
|
269
273
|
* @example Uri.encode("word", encodeSet=Uri.EncodeCustom(c => c == 'o')) // "w%6Frd"
|
|
270
|
-
*
|
|
274
|
+
*
|
|
271
275
|
* @since v0.6.0
|
|
272
276
|
*/
|
|
273
277
|
provide let encode = (str, encodeSet=EncodeNonUnreserved) => {
|
|
@@ -301,10 +305,10 @@ provide let encode = (str, encodeSet=EncodeNonUnreserved) => {
|
|
|
301
305
|
|
|
302
306
|
/**
|
|
303
307
|
* Decodes any percent-encoded characters in a string.
|
|
304
|
-
*
|
|
308
|
+
*
|
|
305
309
|
* @param str: The string to decode
|
|
306
310
|
* @returns `Ok(decoded)` containing the decoded string or `Err(err)` if the decoding failed
|
|
307
|
-
*
|
|
311
|
+
*
|
|
308
312
|
* @since v0.6.0
|
|
309
313
|
*/
|
|
310
314
|
provide let decode = str => {
|
|
@@ -317,10 +321,10 @@ provide let decode = str => {
|
|
|
317
321
|
|
|
318
322
|
/**
|
|
319
323
|
* Encodes a list of key-value pairs into an query string.
|
|
320
|
-
*
|
|
324
|
+
*
|
|
321
325
|
* @param urlVals: A list of key-value pairs
|
|
322
326
|
* @returns A query string
|
|
323
|
-
*
|
|
327
|
+
*
|
|
324
328
|
* @since v0.6.0
|
|
325
329
|
*/
|
|
326
330
|
provide let encodeQuery = (urlVals, encodeSet=EncodeNonUnreserved) => {
|
|
@@ -333,10 +337,10 @@ provide let encodeQuery = (urlVals, encodeSet=EncodeNonUnreserved) => {
|
|
|
333
337
|
|
|
334
338
|
/**
|
|
335
339
|
* Decodes a query string into a list of pairs.
|
|
336
|
-
*
|
|
340
|
+
*
|
|
337
341
|
* @param str: A query string
|
|
338
342
|
* @returns `Ok(decoded)` containing a list of key-value pairs from the decoded string or `Err(err)` if the decoding failed
|
|
339
|
-
*
|
|
343
|
+
*
|
|
340
344
|
* @since v0.6.0
|
|
341
345
|
*/
|
|
342
346
|
provide let decodeQuery = str => {
|
|
@@ -419,7 +423,7 @@ module Matchers {
|
|
|
419
423
|
}
|
|
420
424
|
}
|
|
421
425
|
|
|
422
|
-
provide let digit = charTest(Char.
|
|
426
|
+
provide let digit = charTest(Char.Ascii.isDigit)
|
|
423
427
|
|
|
424
428
|
provide let digitInRange = (low, high) => charTest(char => {
|
|
425
429
|
let code = Char.code(char)
|
|
@@ -427,7 +431,7 @@ module Matchers {
|
|
|
427
431
|
code >= zero + low && code <= zero + high
|
|
428
432
|
})
|
|
429
433
|
|
|
430
|
-
provide let alpha = charTest(Char.
|
|
434
|
+
provide let alpha = charTest(Char.Ascii.isAlpha)
|
|
431
435
|
|
|
432
436
|
provide let hexDigit = charTest(isHexDigit)
|
|
433
437
|
|
|
@@ -698,13 +702,13 @@ let parseFragment = (i, str, withDelim=false) => {
|
|
|
698
702
|
* Parses a string into a `Uri` according to RFC 3986. If the URI string has a
|
|
699
703
|
* path it will be automatically normalized, removing unnecessary `.` and `..`
|
|
700
704
|
* segments.
|
|
701
|
-
*
|
|
705
|
+
*
|
|
702
706
|
* @param str: The RFC 3986 URI string to parse
|
|
703
707
|
* @returns `Ok(uri)` containing a `Uri` if the given string is a valid URI or `Err(ParseError)` otherwise
|
|
704
|
-
*
|
|
708
|
+
*
|
|
705
709
|
* @example Uri.parse("https://grain-lang.org") == Ok(...)
|
|
706
710
|
* @example Uri.parse("http://@*^%") == Err(Uri.ParseError)
|
|
707
|
-
*
|
|
711
|
+
*
|
|
708
712
|
* @since v0.6.0
|
|
709
713
|
*/
|
|
710
714
|
provide let parse = str => {
|
|
@@ -727,15 +731,15 @@ provide let parse = str => {
|
|
|
727
731
|
|
|
728
732
|
/**
|
|
729
733
|
* Transforms a base URI and a URI reference into a target URI
|
|
730
|
-
*
|
|
734
|
+
*
|
|
731
735
|
* @param base: The base URI to resolve a URI reference on
|
|
732
736
|
* @param ref: The URI reference to apply onto the base
|
|
733
737
|
* @returns `Ok(uri)` containing the target `Uri` or `Err(err)` if the input is malformed
|
|
734
|
-
*
|
|
738
|
+
*
|
|
735
739
|
* @example resolveReference(unwrap(parse("https://grain-lang.org/docs/stdlib/uri")), unwrap(parse("../intro"))) // https://grain-lang.org/docs/intro
|
|
736
740
|
* @example resolveReference(unwrap(parse("https://grain-lang.org/docs")), unwrap(parse("?key=val"))) // https://grain-lang.org/docs?key=val
|
|
737
741
|
* @example resolveReference(unwrap(parse("https://grain-lang.org/docs")), unwrap(parse("google.com/search"))) // https://google.com/search
|
|
738
|
-
*
|
|
742
|
+
*
|
|
739
743
|
* @since v0.6.0
|
|
740
744
|
*/
|
|
741
745
|
provide let resolveReference = (base, ref) => {
|
|
@@ -779,7 +783,7 @@ provide let resolveReference = (base, ref) => {
|
|
|
779
783
|
|
|
780
784
|
/**
|
|
781
785
|
* Constructs a new `Uri` from components.
|
|
782
|
-
*
|
|
786
|
+
*
|
|
783
787
|
* @param scheme: `Some(scheme)` containing the desired scheme component or `None` for a scheme-less URI
|
|
784
788
|
* @param userinfo: `Some(userinfo)` containing the desired userinfo component or `None` for a userinfo-less URI
|
|
785
789
|
* @param host: `Some(host)` containing the desired host component or `None` for a host-less URI
|
|
@@ -788,12 +792,12 @@ provide let resolveReference = (base, ref) => {
|
|
|
788
792
|
* @param query: `Some(query)` containing the desired query string component or `None` for a query-less URI
|
|
789
793
|
* @param fragment: `Some(fragment)` containing the desired fragment component or `None` for a fragment-less URI
|
|
790
794
|
* @param encodeComponents: Whether or not to apply percent encoding for each component to remove unsafe characters for each component
|
|
791
|
-
*
|
|
795
|
+
*
|
|
792
796
|
* @example Uri.make(scheme=Some("https"), host=Some("grain-lang.org")) // https://grain-lang.org
|
|
793
797
|
* @example Uri.make(host=Some("g/r@in"), encodeComponents=false) // Err(Uri.InvalidHostError)
|
|
794
798
|
* @example Uri.make(scheme=Some("abc"), host=Some("g/r@in"), query=Some("k/ey=v^@l"), encodeComponents=true) // abc://g%2Fr%40in?k/ey=v%5E@l
|
|
795
799
|
* @example Uri.make(port=Some(80)) // Err(Uri.PortWithNoHost)
|
|
796
|
-
*
|
|
800
|
+
*
|
|
797
801
|
* @since v0.6.0
|
|
798
802
|
*/
|
|
799
803
|
provide let make = (
|
|
@@ -909,7 +913,7 @@ enum UpdateAction<a> {
|
|
|
909
913
|
* pattern used to update each component is that `None` means the base URI's
|
|
910
914
|
* component should be used and `Some(val)` means that a new value should be
|
|
911
915
|
* used for that component.
|
|
912
|
-
*
|
|
916
|
+
*
|
|
913
917
|
* @param uri: The `Uri` to update
|
|
914
918
|
* @param scheme: `Some(scheme)` containing the desired updated scheme component or `None` to maintain the base URI's scheme
|
|
915
919
|
* @param userinfo: `Some(userinfo)` containing the desired updated userinfo component or `None` to maintain the base URI's userinfo
|
|
@@ -919,13 +923,13 @@ enum UpdateAction<a> {
|
|
|
919
923
|
* @param query: `Some(query)` containing the desired updated query string component or `None` to maintain the base URI's query
|
|
920
924
|
* @param fragment: `Some(fragment)` containing the desired updated fragment component or `None` to maintain the base URI's fragment
|
|
921
925
|
* @param encodeComponents: Whether or not to apply percent encoding for each updated component to remove unsafe characters
|
|
922
|
-
*
|
|
926
|
+
*
|
|
923
927
|
* @example let uri = Result.unwrap(Uri.parse("https://grain-lang.org/docs?k=v")) // Base URI for following examples
|
|
924
928
|
* @example Uri.update(uri, scheme=Some(Some("ftp"))) // ftp://grain-lang.org/docs?k=v
|
|
925
929
|
* @example Uri.update(uri, query=Some(None)) // https://grain-lang.org/docs
|
|
926
930
|
* @example Uri.update(uri, host=Some(Some("g/r@in")), encodeComponents=true) // https://g%2Fr%40in/docs?k=v
|
|
927
931
|
* @example Uri.update(uri, host=Some(None), port=Some(Some(80))) // Err(Uri.PortWithNoHost)
|
|
928
|
-
*
|
|
932
|
+
*
|
|
929
933
|
* @since v0.6.0
|
|
930
934
|
*/
|
|
931
935
|
provide let update = (
|
|
@@ -1053,41 +1057,41 @@ provide let update = (
|
|
|
1053
1057
|
|
|
1054
1058
|
/**
|
|
1055
1059
|
* Determines whether a `Uri` has an authority (i.e. has a host component)
|
|
1056
|
-
*
|
|
1060
|
+
*
|
|
1057
1061
|
* @param uri: The `Uri` to consider
|
|
1058
1062
|
* @returns `true` if the `Uri` has an authority component or `false` otherwise
|
|
1059
|
-
*
|
|
1063
|
+
*
|
|
1060
1064
|
* @since v0.6.0
|
|
1061
1065
|
*/
|
|
1062
1066
|
provide let hasAuthority = uri => uri.host != None
|
|
1063
1067
|
|
|
1064
1068
|
/**
|
|
1065
1069
|
* Determines whether a `Uri` is an absolute URI (has a scheme component)
|
|
1066
|
-
*
|
|
1070
|
+
*
|
|
1067
1071
|
* @param uri: The `Uri` to consider
|
|
1068
1072
|
* @returns `true` if the `Uri` is absolute (has a scheme component) or `false` otherwise
|
|
1069
|
-
*
|
|
1073
|
+
*
|
|
1070
1074
|
* @since v0.6.0
|
|
1071
1075
|
*/
|
|
1072
1076
|
provide let isAbsolute = uri => uri.scheme != None
|
|
1073
1077
|
|
|
1074
1078
|
/**
|
|
1075
1079
|
* Converts the given `Uri` into a string.
|
|
1076
|
-
*
|
|
1080
|
+
*
|
|
1077
1081
|
* @param uri: The `Uri` to convert
|
|
1078
1082
|
* @returns A string representation of the `Uri`
|
|
1079
|
-
*
|
|
1083
|
+
*
|
|
1080
1084
|
* @since v0.6.0
|
|
1081
1085
|
*/
|
|
1082
1086
|
provide let toString = uri => {
|
|
1083
1087
|
let optStr = (opt, display) => Option.mapWithDefault(display, "", opt)
|
|
1084
1088
|
|
|
1085
|
-
optStr(uri.scheme, s => s ++ ":")
|
|
1086
|
-
optStr(uri.host, (_) => "//")
|
|
1087
|
-
optStr(uri.userinfo, u => u ++ "@")
|
|
1088
|
-
optStr(uri.host, identity)
|
|
1089
|
-
optStr(uri.port, p => ":" ++ toString(p))
|
|
1090
|
-
uri.path
|
|
1091
|
-
optStr(uri.query, q => "?" ++ q)
|
|
1092
|
-
optStr(uri.fragment, f => "#" ++ f)
|
|
1089
|
+
optStr(uri.scheme, s => s ++ ":")
|
|
1090
|
+
++ optStr(uri.host, (_) => "//")
|
|
1091
|
+
++ optStr(uri.userinfo, u => u ++ "@")
|
|
1092
|
+
++ optStr(uri.host, identity)
|
|
1093
|
+
++ optStr(uri.port, p => ":" ++ toString(p))
|
|
1094
|
+
++ uri.path
|
|
1095
|
+
++ optStr(uri.query, q => "?" ++ q)
|
|
1096
|
+
++ optStr(uri.fragment, f => "#" ++ f)
|
|
1093
1097
|
}
|
package/uri.md
CHANGED
|
@@ -109,7 +109,7 @@ No other changes yet.
|
|
|
109
109
|
</details>
|
|
110
110
|
|
|
111
111
|
```grain
|
|
112
|
-
encode
|
|
112
|
+
encode: (str: String, ?encodeSet: EncodeSet) => String
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
Percent-encodes characters in a string based on the specified `EncodeSet`.
|
|
@@ -149,7 +149,7 @@ No other changes yet.
|
|
|
149
149
|
</details>
|
|
150
150
|
|
|
151
151
|
```grain
|
|
152
|
-
decode
|
|
152
|
+
decode: (str: String) => Result<String, DecodingError>
|
|
153
153
|
```
|
|
154
154
|
|
|
155
155
|
Decodes any percent-encoded characters in a string.
|
|
@@ -174,7 +174,7 @@ No other changes yet.
|
|
|
174
174
|
</details>
|
|
175
175
|
|
|
176
176
|
```grain
|
|
177
|
-
encodeQuery
|
|
177
|
+
encodeQuery:
|
|
178
178
|
(urlVals: List<(String, String)>, ?encodeSet: EncodeSet) => String
|
|
179
179
|
```
|
|
180
180
|
|
|
@@ -200,7 +200,7 @@ No other changes yet.
|
|
|
200
200
|
</details>
|
|
201
201
|
|
|
202
202
|
```grain
|
|
203
|
-
decodeQuery
|
|
203
|
+
decodeQuery: (str: String) => Result<List<(String, String)>, DecodingError>
|
|
204
204
|
```
|
|
205
205
|
|
|
206
206
|
Decodes a query string into a list of pairs.
|
|
@@ -225,7 +225,7 @@ No other changes yet.
|
|
|
225
225
|
</details>
|
|
226
226
|
|
|
227
227
|
```grain
|
|
228
|
-
parse
|
|
228
|
+
parse: (str: String) => Result<Uri, ParseError>
|
|
229
229
|
```
|
|
230
230
|
|
|
231
231
|
Parses a string into a `Uri` according to RFC 3986. If the URI string has a
|
|
@@ -262,8 +262,7 @@ No other changes yet.
|
|
|
262
262
|
</details>
|
|
263
263
|
|
|
264
264
|
```grain
|
|
265
|
-
resolveReference :
|
|
266
|
-
(base: Uri, ref: Uri) => Result<Uri, ResolveReferenceError>
|
|
265
|
+
resolveReference: (base: Uri, ref: Uri) => Result<Uri, ResolveReferenceError>
|
|
267
266
|
```
|
|
268
267
|
|
|
269
268
|
Transforms a base URI and a URI reference into a target URI
|
|
@@ -303,7 +302,7 @@ No other changes yet.
|
|
|
303
302
|
</details>
|
|
304
303
|
|
|
305
304
|
```grain
|
|
306
|
-
make
|
|
305
|
+
make:
|
|
307
306
|
(?scheme: Option<String>, ?userinfo: Option<String>, ?host: Option<String>,
|
|
308
307
|
?port: Option<Number>, ?path: String, ?query: Option<String>,
|
|
309
308
|
?fragment: Option<String>, ?encodeComponents: Bool) =>
|
|
@@ -351,7 +350,7 @@ No other changes yet.
|
|
|
351
350
|
</details>
|
|
352
351
|
|
|
353
352
|
```grain
|
|
354
|
-
update
|
|
353
|
+
update:
|
|
355
354
|
(uri: Uri, ?scheme: Option<Option<String>>,
|
|
356
355
|
?userinfo: Option<Option<String>>, ?host: Option<Option<String>>,
|
|
357
356
|
?port: Option<Option<Number>>, ?path: Option<String>,
|
|
@@ -408,7 +407,7 @@ No other changes yet.
|
|
|
408
407
|
</details>
|
|
409
408
|
|
|
410
409
|
```grain
|
|
411
|
-
hasAuthority
|
|
410
|
+
hasAuthority: (uri: Uri) => Bool
|
|
412
411
|
```
|
|
413
412
|
|
|
414
413
|
Determines whether a `Uri` has an authority (i.e. has a host component)
|
|
@@ -433,7 +432,7 @@ No other changes yet.
|
|
|
433
432
|
</details>
|
|
434
433
|
|
|
435
434
|
```grain
|
|
436
|
-
isAbsolute
|
|
435
|
+
isAbsolute: (uri: Uri) => Bool
|
|
437
436
|
```
|
|
438
437
|
|
|
439
438
|
Determines whether a `Uri` is an absolute URI (has a scheme component)
|
|
@@ -458,7 +457,7 @@ No other changes yet.
|
|
|
458
457
|
</details>
|
|
459
458
|
|
|
460
459
|
```grain
|
|
461
|
-
toString
|
|
460
|
+
toString: (uri: Uri) => String
|
|
462
461
|
```
|
|
463
462
|
|
|
464
463
|
Converts the given `Uri` into a string.
|