refactor: rename mod.ts to index.ts, + misc improvements#13
Merged
Conversation
- use IEEE754 format representation - expose format spec from ./constants.ts as default export - simplify f16round.ts, use roundFloat16 internally
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the codebase to use index.ts instead of mod.ts as module entrypoints, aligning with modern JavaScript/TypeScript conventions. The changes also include improvements to documentation, inline JSR imports for test utilities, and refactoring of the float16/float32 encode/decode functions to use shared configuration objects.
Changes:
- Renamed all
mod.tsfiles toindex.tsacross the codebase (root, constants, guards, types, float16, float32) - Updated test files to use inline JSR import specifiers instead of import map
- Refactored float16/float32 encode/decode functions to use default exported configuration objects
- Improved documentation and added missing @tags annotations in guard functions
Reviewed changes
Copilot reviewed 27 out of 31 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| src/index.ts | New main entry point with all exports; replaces root mod.ts |
| src/types/index.ts | New types module entry point |
| src/guards/index.ts | New guards module entry point with improved documentation |
| src/guards/safe_integer.ts | Updated implementation to inline integer check; added documentation notes |
| src/guards/integer.ts | Added isNumberInteger function; improved documentation |
| src/guards/negative_infinity.ts | Fixed category from "Arithmetic" to "Guards"; added @tags |
| src/guards/positive_infinity.ts | Added @tags annotation |
| src/constants/index.ts | New constants module entry point |
| src/float16/index.ts | New float16 module entry point |
| src/float16/constants.ts | Changed bit counts to hex notation; added default export object |
| src/float16/encode.ts | Simplified to use default config object |
| src/float16/decode.ts | Simplified to use default config object |
| src/float16/round.ts | Updated import aliases; improved doctest example |
| src/float32/index.ts | New float32 module entry point |
| src/float32/constants.ts | Changed bit count to hex notation; added default export object |
| src/float32/encode.ts | Simplified to use default config object |
| src/float32/decode.ts | Simplified to use default config object |
| src/float32/round.ts | Improved doctest example (though with a bug) |
| src/ieee754.ts | Updated imports to use new index.ts paths |
| src/f16round.ts | Simplified to call roundFloat16 directly |
| src/fround.ts | Simplified to call roundFloat32 directly |
| src/sin.ts | Updated imports to individual constant files |
| src/asin.ts | Updated imports to individual constant files |
| src/acosh.ts | Updated imports to individual constant files |
| src/exp.ts | Updated doctest to use node:assert |
| src/trigonometry.test.ts | Updated to use inline JSR imports and new index.ts path |
| src/random.test.ts | Updated to use inline JSR imports |
| src/constants.test.ts | Updated to use inline JSR imports and new index.ts path |
| mod.ts | Deleted root entry point (moved to src/index.ts) |
| deno.json | Updated all exports to point to index.ts files; removed imports section; added lint config |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #12.
Changes