Skip to content

Commit

Permalink
chore(docs): Add examples to Hash module (#2011)
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake authored Mar 2, 2024
1 parent 588a3b8 commit b6843ce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stdlib/hash.gr
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
*
* @example from "hash" include Hash
*
* @example Hash.hash(1)
* @example Hash.hash("Hello World")
*
* @since v0.1.0
*/
module Hash
Expand Down Expand Up @@ -237,6 +240,9 @@ let rec hashOne = (val, depth) => {
* @param anything: The value to hash
* @returns A hash for the given value
*
* @example assert Hash.hash(1) == Hash.hash(1)
* @example assert Hash.hash("Hello World") == Hash.hash("Hello World")
*
* @since v0.1.0
*/
@unsafe
Expand Down
18 changes: 18 additions & 0 deletions stdlib/hash.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ No other changes yet.
from "hash" include Hash
```

```grain
Hash.hash(1)
```

```grain
Hash.hash("Hello World")
```

## Values

Functions and constants included in the Hash module.
Expand Down Expand Up @@ -42,3 +50,13 @@ Returns:
|----|-----------|
|`Number`|A hash for the given value|

Examples:

```grain
assert Hash.hash(1) == Hash.hash(1)
```

```grain
assert Hash.hash("Hello World") == Hash.hash("Hello World")
```

0 comments on commit b6843ce

Please sign in to comment.