Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(docs): Add examples to Hash module #2011

Merged
merged 1 commit into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 include "hash"
*
* @example Hash.hash(1)
* @example Hash.hash("Hello World")
*
* @since v0.1.0
*/

Expand Down Expand Up @@ -242,6 +245,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.
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")
```

Loading