@grain/stdlib 0.7.0 → 0.7.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 +10 -0
- package/array.md +491 -491
- package/bigint.md +198 -198
- package/buffer.gr +66 -1
- package/buffer.md +395 -272
- package/bytes.gr +1 -0
- package/bytes.md +200 -199
- package/char.md +125 -125
- package/exception.md +9 -9
- package/float32.md +195 -195
- package/float64.md +195 -195
- package/fs.md +115 -115
- package/hash.md +16 -16
- package/int16.md +155 -155
- package/int32.gr +1 -1
- package/int32.md +207 -207
- package/int64.gr +1 -1
- package/int64.md +207 -207
- package/int8.md +155 -155
- package/json.md +59 -59
- package/list.md +347 -347
- package/map.md +222 -222
- package/marshal.md +12 -12
- package/number.gr +119 -5
- package/number.md +503 -261
- package/option.md +141 -141
- package/package.json +1 -1
- package/path.md +90 -90
- package/pervasives.md +238 -238
- package/priorityqueue.md +112 -112
- package/queue.md +117 -117
- package/random.md +37 -37
- package/range.md +36 -36
- package/rational.md +107 -107
- package/regex.md +91 -91
- package/result.md +102 -102
- package/runtime/atof/decimal.md +6 -6
- package/runtime/compare.md +7 -7
- package/runtime/dataStructures.md +178 -178
- package/runtime/equal.md +7 -7
- package/runtime/exception.md +15 -15
- package/runtime/malloc.md +9 -9
- package/runtime/numbers.md +269 -269
- package/runtime/string.md +17 -17
- package/runtime/unsafe/conv.md +6 -6
- package/runtime/unsafe/memory.md +10 -10
- package/runtime/utf8.md +31 -31
- package/runtime/wasi.md +9 -9
- package/set.md +211 -211
- package/stack.md +122 -122
- package/string.md +228 -228
- package/uint16.md +148 -148
- package/uint32.md +192 -192
- package/uint64.md +192 -192
- package/uint8.md +148 -148
- package/uri.md +77 -77
- package/wasi/file.md +269 -269
- package/wasi/process.md +21 -21
- package/wasi/random.md +9 -9
- package/wasi/time.md +12 -12
package/path.md
CHANGED
|
@@ -194,16 +194,16 @@ ambiguity.
|
|
|
194
194
|
|
|
195
195
|
Parameters:
|
|
196
196
|
|
|
197
|
-
|param|type|description|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
197
|
+
| param | type | description |
|
|
198
|
+
| ----------- | ---------- | ------------------------------------------------------------- |
|
|
199
|
+
| `pathStr` | `String` | The string to parse as a path |
|
|
200
|
+
| `?platform` | `Platform` | The platform whose path separators should be used for parsing |
|
|
201
201
|
|
|
202
202
|
Returns:
|
|
203
203
|
|
|
204
|
-
|type|description|
|
|
205
|
-
|
|
206
|
-
|
|
204
|
+
| type | description |
|
|
205
|
+
| ------ | ----------------------------------------------------- |
|
|
206
|
+
| `Path` | The path wrapped with details encoded within the type |
|
|
207
207
|
|
|
208
208
|
Examples:
|
|
209
209
|
|
|
@@ -247,16 +247,16 @@ A trailing slash is added to directory paths.
|
|
|
247
247
|
|
|
248
248
|
Parameters:
|
|
249
249
|
|
|
250
|
-
|param|type|description|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
250
|
+
| param | type | description |
|
|
251
|
+
| ----------- | ---------- | ------------------------------------------------------- |
|
|
252
|
+
| `path` | `Path` | The path to convert to a string |
|
|
253
|
+
| `?platform` | `Platform` | The `Platform` to use to represent the path as a string |
|
|
254
254
|
|
|
255
255
|
Returns:
|
|
256
256
|
|
|
257
|
-
|type|description|
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
| type | description |
|
|
258
|
+
| -------- | ------------------------------------ |
|
|
259
|
+
| `String` | A string representing the given path |
|
|
260
260
|
|
|
261
261
|
Examples:
|
|
262
262
|
|
|
@@ -287,15 +287,15 @@ Determines whether the path is a directory path.
|
|
|
287
287
|
|
|
288
288
|
Parameters:
|
|
289
289
|
|
|
290
|
-
|param|type|description|
|
|
291
|
-
|
|
292
|
-
|
|
290
|
+
| param | type | description |
|
|
291
|
+
| ------ | ------ | ------------------- |
|
|
292
|
+
| `path` | `Path` | The path to inspect |
|
|
293
293
|
|
|
294
294
|
Returns:
|
|
295
295
|
|
|
296
|
-
|type|description|
|
|
297
|
-
|
|
298
|
-
|
|
296
|
+
| type | description |
|
|
297
|
+
| ------ | ----------------------------------------------------------- |
|
|
298
|
+
| `Bool` | `true` if the path is a directory path or `false` otherwise |
|
|
299
299
|
|
|
300
300
|
Examples:
|
|
301
301
|
|
|
@@ -317,15 +317,15 @@ Determines whether the path is an absolute path.
|
|
|
317
317
|
|
|
318
318
|
Parameters:
|
|
319
319
|
|
|
320
|
-
|param|type|description|
|
|
321
|
-
|
|
322
|
-
|
|
320
|
+
| param | type | description |
|
|
321
|
+
| ------ | ------ | ------------------- |
|
|
322
|
+
| `path` | `Path` | The path to inspect |
|
|
323
323
|
|
|
324
324
|
Returns:
|
|
325
325
|
|
|
326
|
-
|type|description|
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
| type | description |
|
|
327
|
+
| ------ | --------------------------------------------------- |
|
|
328
|
+
| `Bool` | `true` if the path is absolute or `false` otherwise |
|
|
329
329
|
|
|
330
330
|
Examples:
|
|
331
331
|
|
|
@@ -352,16 +352,16 @@ Creates a new path by appending a relative path segment to a directory path.
|
|
|
352
352
|
|
|
353
353
|
Parameters:
|
|
354
354
|
|
|
355
|
-
|param|type|description|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
355
|
+
| param | type | description |
|
|
356
|
+
| ---------- | ------ | --------------------------- |
|
|
357
|
+
| `path` | `Path` | The base path |
|
|
358
|
+
| `toAppend` | `Path` | The relative path to append |
|
|
359
359
|
|
|
360
360
|
Returns:
|
|
361
361
|
|
|
362
|
-
|type|description|
|
|
363
|
-
|
|
364
|
-
|
|
362
|
+
| type | description |
|
|
363
|
+
| --------------------------- | -------------------------------------------------------------------------------------------- |
|
|
364
|
+
| `Result<Path, AppendError>` | `Ok(path)` combining the base and appended paths or `Err(err)` if the paths are incompatible |
|
|
365
365
|
|
|
366
366
|
Examples:
|
|
367
367
|
|
|
@@ -399,16 +399,16 @@ source, the result will be `Err(ImpossibleRelativization)`.
|
|
|
399
399
|
|
|
400
400
|
Parameters:
|
|
401
401
|
|
|
402
|
-
|param|type|description|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
402
|
+
| param | type | description |
|
|
403
|
+
| -------- | ------ | ------------------------------- |
|
|
404
|
+
| `source` | `Path` | The source path |
|
|
405
|
+
| `dest` | `Path` | The destination path to resolve |
|
|
406
406
|
|
|
407
407
|
Returns:
|
|
408
408
|
|
|
409
|
-
|type|description|
|
|
410
|
-
|
|
411
|
-
|
|
409
|
+
| type | description |
|
|
410
|
+
| ----------------------------------- | ---------------------------------------------------------------------------------------- |
|
|
411
|
+
| `Result<Path, RelativizationError>` | `Ok(path)` containing the relative path if successfully resolved or `Err(err)` otherwise |
|
|
412
412
|
|
|
413
413
|
Examples:
|
|
414
414
|
|
|
@@ -452,16 +452,16 @@ Determines the relative ancestry betwen two paths.
|
|
|
452
452
|
|
|
453
453
|
Parameters:
|
|
454
454
|
|
|
455
|
-
|param|type|description|
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
455
|
+
| param | type | description |
|
|
456
|
+
| ------ | ------ | --------------------------- |
|
|
457
|
+
| `base` | `Path` | The first path to consider |
|
|
458
|
+
| `path` | `Path` | The second path to consider |
|
|
459
459
|
|
|
460
460
|
Returns:
|
|
461
461
|
|
|
462
|
-
|type|description|
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
| type | description |
|
|
463
|
+
| ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
|
|
464
|
+
| `Result<AncestryStatus, IncompatibilityError>` | `Ok(ancestryStatus)` with the relative ancestry between the paths if they are compatible or `Err(err)` if they are incompatible |
|
|
465
465
|
|
|
466
466
|
Examples:
|
|
467
467
|
|
|
@@ -496,15 +496,15 @@ Retrieves the path corresponding to the parent directory of the given path.
|
|
|
496
496
|
|
|
497
497
|
Parameters:
|
|
498
498
|
|
|
499
|
-
|param|type|description|
|
|
500
|
-
|
|
501
|
-
|
|
499
|
+
| param | type | description |
|
|
500
|
+
| ------ | ------ | ------------------- |
|
|
501
|
+
| `path` | `Path` | The path to inspect |
|
|
502
502
|
|
|
503
503
|
Returns:
|
|
504
504
|
|
|
505
|
-
|type|description|
|
|
506
|
-
|
|
507
|
-
|
|
505
|
+
| type | description |
|
|
506
|
+
| ------ | -------------------------------------------------------------- |
|
|
507
|
+
| `Path` | A path corresponding to the parent directory of the given path |
|
|
508
508
|
|
|
509
509
|
Examples:
|
|
510
510
|
|
|
@@ -531,15 +531,15 @@ Retrieves the basename (named final segment) of a path.
|
|
|
531
531
|
|
|
532
532
|
Parameters:
|
|
533
533
|
|
|
534
|
-
|param|type|description|
|
|
535
|
-
|
|
536
|
-
|
|
534
|
+
| param | type | description |
|
|
535
|
+
| ------ | ------ | ------------------- |
|
|
536
|
+
| `path` | `Path` | The path to inspect |
|
|
537
537
|
|
|
538
538
|
Returns:
|
|
539
539
|
|
|
540
|
-
|type|description|
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
| type | description |
|
|
541
|
+
| ---------------- | ---------------------------------------------------------------------------------------- |
|
|
542
|
+
| `Option<String>` | `Some(path)` containing the basename of the path or `None` if the path does not have one |
|
|
543
543
|
|
|
544
544
|
Examples:
|
|
545
545
|
|
|
@@ -566,15 +566,15 @@ Retrieves the basename of a file path without the extension.
|
|
|
566
566
|
|
|
567
567
|
Parameters:
|
|
568
568
|
|
|
569
|
-
|param|type|description|
|
|
570
|
-
|
|
571
|
-
|
|
569
|
+
| param | type | description |
|
|
570
|
+
| ------ | ------ | ------------------- |
|
|
571
|
+
| `path` | `Path` | The path to inspect |
|
|
572
572
|
|
|
573
573
|
Returns:
|
|
574
574
|
|
|
575
|
-
|type|description|
|
|
576
|
-
|
|
577
|
-
|
|
575
|
+
| type | description |
|
|
576
|
+
| ------------------------------------ | --------------------------------------------------------------------------------------------- |
|
|
577
|
+
| `Result<String, PathOperationError>` | `Ok(path)` containing the stem of the file path or `Err(err)` if the path is a directory path |
|
|
578
578
|
|
|
579
579
|
Examples:
|
|
580
580
|
|
|
@@ -609,15 +609,15 @@ Retrieves the extension on the basename of a file path.
|
|
|
609
609
|
|
|
610
610
|
Parameters:
|
|
611
611
|
|
|
612
|
-
|param|type|description|
|
|
613
|
-
|
|
614
|
-
|
|
612
|
+
| param | type | description |
|
|
613
|
+
| ------ | ------ | ------------------- |
|
|
614
|
+
| `path` | `Path` | The path to inspect |
|
|
615
615
|
|
|
616
616
|
Returns:
|
|
617
617
|
|
|
618
|
-
|type|description|
|
|
619
|
-
|
|
620
|
-
|
|
618
|
+
| type | description |
|
|
619
|
+
| ------------------------------------ | -------------------------------------------------------------------------------------------------- |
|
|
620
|
+
| `Result<String, PathOperationError>` | `Ok(path)` containing the extension of the file path or `Err(err)` if the path is a directory path |
|
|
621
621
|
|
|
622
622
|
Examples:
|
|
623
623
|
|
|
@@ -652,15 +652,15 @@ Removes the extension from a path, if there is no extension, returns the path as
|
|
|
652
652
|
|
|
653
653
|
Parameters:
|
|
654
654
|
|
|
655
|
-
|param|type|description|
|
|
656
|
-
|
|
657
|
-
|
|
655
|
+
| param | type | description |
|
|
656
|
+
| ------ | ------ | ------------------ |
|
|
657
|
+
| `path` | `Path` | The path to modify |
|
|
658
658
|
|
|
659
659
|
Returns:
|
|
660
660
|
|
|
661
|
-
|type|description|
|
|
662
|
-
|
|
663
|
-
|
|
661
|
+
| type | description |
|
|
662
|
+
| ------ | ----------------------------------- |
|
|
663
|
+
| `Path` | The path with the extension removed |
|
|
664
664
|
|
|
665
665
|
Examples:
|
|
666
666
|
|
|
@@ -695,16 +695,16 @@ Updates the file extension of the given path.
|
|
|
695
695
|
|
|
696
696
|
Parameters:
|
|
697
697
|
|
|
698
|
-
|param|type|description|
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
698
|
+
| param | type | description |
|
|
699
|
+
| ----------- | -------- | ------------------ |
|
|
700
|
+
| `path` | `Path` | The path to modify |
|
|
701
|
+
| `extension` | `String` | The new extension |
|
|
702
702
|
|
|
703
703
|
Returns:
|
|
704
704
|
|
|
705
|
-
|type|description|
|
|
706
|
-
|
|
707
|
-
|
|
705
|
+
| type | description |
|
|
706
|
+
| ------ | ----------------- |
|
|
707
|
+
| `Path` | The modified path |
|
|
708
708
|
|
|
709
709
|
Examples:
|
|
710
710
|
|
|
@@ -743,15 +743,15 @@ Retrieves the root of the absolute path.
|
|
|
743
743
|
|
|
744
744
|
Parameters:
|
|
745
745
|
|
|
746
|
-
|param|type|description|
|
|
747
|
-
|
|
748
|
-
|
|
746
|
+
| param | type | description |
|
|
747
|
+
| ------ | ------ | ------------------- |
|
|
748
|
+
| `path` | `Path` | The path to inspect |
|
|
749
749
|
|
|
750
750
|
Returns:
|
|
751
751
|
|
|
752
|
-
|type|description|
|
|
753
|
-
|
|
754
|
-
|
|
752
|
+
| type | description |
|
|
753
|
+
| ------------------------------------------ | --------------------------------------------------------------------------------------- |
|
|
754
|
+
| `Result<AbsoluteRoot, PathOperationError>` | `Ok(root)` containing the root of the path or `Err(err)` if the path is a relative path |
|
|
755
755
|
|
|
756
756
|
Examples:
|
|
757
757
|
|