Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
chore: add jsdoc
  • Loading branch information
achingbrain committed Jul 23, 2025
commit 01ae0bb8999bbd33a4f4b91fde21a480dd82845a
10 changes: 10 additions & 0 deletions src/hashes/hasher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ export function from <Name extends string, Code extends number> ({ name, code, e
}

export interface DigestOptions {
Copy link
Contributor

@2color 2color Jul 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add the unit type in the JS doc so it's clear truncate is in bytes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a doc comment, let me know if you think it's clear.

/**
* Truncate the returned digest to this number of bytes.
*
* This may cause the digest method to throw/reject if the passed value is
* greater than the digest length or below a threshold under which the risk of
* hash collisions is significant.
*
* The actual value of this threshold can depend on the hashing algorithm in
* use.
*/
truncate?: number
}

Expand Down
Loading