Skip to content

Commit b6843ce

Browse files
authored
chore(docs): Add examples to Hash module (#2011)
1 parent 588a3b8 commit b6843ce

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

stdlib/hash.gr

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
*
44
* @example from "hash" include Hash
55
*
6+
* @example Hash.hash(1)
7+
* @example Hash.hash("Hello World")
8+
*
69
* @since v0.1.0
710
*/
811
module Hash
@@ -237,6 +240,9 @@ let rec hashOne = (val, depth) => {
237240
* @param anything: The value to hash
238241
* @returns A hash for the given value
239242
*
243+
* @example assert Hash.hash(1) == Hash.hash(1)
244+
* @example assert Hash.hash("Hello World") == Hash.hash("Hello World")
245+
*
240246
* @since v0.1.0
241247
*/
242248
@unsafe

stdlib/hash.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ No other changes yet.
1313
from "hash" include Hash
1414
```
1515

16+
```grain
17+
Hash.hash(1)
18+
```
19+
20+
```grain
21+
Hash.hash("Hello World")
22+
```
23+
1624
## Values
1725

1826
Functions and constants included in the Hash module.
@@ -42,3 +50,13 @@ Returns:
4250
|----|-----------|
4351
|`Number`|A hash for the given value|
4452

53+
Examples:
54+
55+
```grain
56+
assert Hash.hash(1) == Hash.hash(1)
57+
```
58+
59+
```grain
60+
assert Hash.hash("Hello World") == Hash.hash("Hello World")
61+
```
62+

0 commit comments

Comments
 (0)