Skip to content

Conversation

@WavePlayz
Copy link

This commit introduces two key improvements to the Blake2B implementation:

  1. Comprehensive JSDoc Documentation:
  • Added JSDoc comments for all functions and classes
  • Documented parameters, return values, and exceptions
  • Maintained all original inline comments and explanations
  • Added type information for better IDE support
  • Documented the Blake namespace and its methods
  • Improved input parameter documentation for normalizeInput()
  1. Universal Export Pattern:
  • Added robust environment detection for exports
  • Supports CommonJS (Node.js), AMD, and browser globals
  • Uses globalThis with fallbacks to window/self
  • Maintains backward compatibility
  • Provides cleaner consumption in all environments

The original functionality remains completely unchanged - these are improvements to documentation and module exports.

All original comments from the reference implementation have been preserved exactly as they were, including:

  • RFC reference comments
  • Performance optimization notes
  • Debugging helper comments
  • Example usage in comments
  • Core algorithm explanations

The changes make the code:

  • Better documented for maintainers
  • More tooling-friendly (IDEs, TypeScript)
  • Easier to consume in different environments
  • More future-proof while maintaining compatibility

This commit introduces two key improvements to the Blake2B implementation:

1. Comprehensive JSDoc Documentation:
- Added JSDoc comments for all functions and classes
- Documented parameters, return values, and exceptions
- Maintained all original inline comments and explanations
- Added type information for better IDE support
- Documented the Blake namespace and its methods
- Improved input parameter documentation for normalizeInput()

2. Universal Export Pattern:
- Added robust environment detection for exports
- Supports CommonJS (Node.js), AMD, and browser globals
- Uses globalThis with fallbacks to window/self
- Maintains backward compatibility
- Provides cleaner consumption in all environments

The original functionality remains completely unchanged - these are
improvements to documentation and module exports.

All original comments from the reference implementation have been
preserved exactly as they were, including:
- RFC reference comments
- Performance optimization notes
- Debugging helper comments
- Example usage in comments
- Core algorithm explanations

The changes make the code:
- Better documented for maintainers
- More tooling-friendly (IDEs, TypeScript)
- Easier to consume in different environments
- More future-proof while maintaining compatibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant