diff --git a/stdlib/hash.gr b/stdlib/hash.gr index f4dfcbdf8..2da37f2b2 100644 --- a/stdlib/hash.gr +++ b/stdlib/hash.gr @@ -3,6 +3,9 @@ * * @example from "hash" include Hash * + * @example Hash.hash(1) + * @example Hash.hash("Hello World") + * * @since v0.1.0 */ module Hash @@ -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 diff --git a/stdlib/hash.md b/stdlib/hash.md index f2ea75b0a..ba8b09e82 100644 --- a/stdlib/hash.md +++ b/stdlib/hash.md @@ -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. @@ -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") +``` +