Refactor: Update dependencies and modernize JavaScript tooling#24
Merged
Refactor: Update dependencies and modernize JavaScript tooling#24
Conversation
This commit brings the project's dependencies up to date and modernizes the JavaScript development environment. Key changes include: - Updated Node.js engine requirement in `package.json` to `>=20`. - Updated all npm dependencies to their latest compatible versions. - Updated ESLint configuration (`.eslintrc`) to use `ecmaVersion: 2022` for better support of modern JavaScript syntax. - Applied auto-fixable linting rules. - Refactored `lib/algorithms/1-strings/compress.js` to use modern JavaScript syntax and improve clarity. `lib/dataStructures/stack.js` was reviewed and confirmed to be already modern. All linters and tests pass, ensuring the codebase remains healthy and functional after these updates.
This commit introduces improvements to the Trie data structure's value handling and significantly expands its test coverage.
Key changes:
- Modified `Trie.getValue()` method in `lib/dataStructures/trie.js` to correctly return `undefined` if a word does not exist or if the queried string is only a prefix of an existing word. It now only returns a value if the exact word is found.
- Added new test suites to `spec/dataStructures/trie.getValue.spec.js` to cover:
- Retrieving values for non-existent words (including prefixes and words longer than existing entries).
- Storing and retrieving various data types (strings, numbers, objects, arrays, empty strings) as custom values.
- Ensured test data aligns with `Trie.add()` method's validation (avoiding `null` values which are disallowed).
- Fixed a `max-len` linting error in the new test file.
All tests (255 specs) and linters now pass, ensuring the Trie's functionality is robust and well-verified.
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.
This commit brings the project's dependencies up to date and modernizes the JavaScript development environment.
Key changes include:
package.jsonto>=20..eslintrc) to useecmaVersion: 2022for better support of modern JavaScript syntax.lib/algorithms/1-strings/compress.jsto use modern JavaScript syntax and improve clarity.lib/dataStructures/stack.jswas reviewed and confirmed to be already modern.All linters and tests pass, ensuring the codebase remains healthy and functional after these updates.