Open
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.
… done so far and provide feedback for Jules to continue.
This commit introduces five new utility algorithms you requested,
focusing on text, data, and geospatial processing, with low existing
coverage in the open-source community.
Algorithms Added:
1. Aho-Corasick with Fuzzy Matching:
- Location: lib/algorithms/1-strings/ahoCorasickFuzzy.js
- Description: Efficiently searches for multiple keywords in text,
with support for fuzzy matching (Levenshtein distance).
- Tests: spec/algo/1-strings/ahoCorasickFuzzy.spec.js
2. HyperLogLog++:
- Location: lib/dataStructures/hyperloglog-plus-plus.js
- Description: A probabilistic data structure for estimating the
cardinality of large datasets with high accuracy and low memory usage.
Includes bias correction.
- Tests: spec/dataStructures/hyperloglog-plus-plus.spec.js
3. Cuckoo Filter:
- Location: lib/dataStructures/cuckoo-filter.js
- Description: A probabilistic data structure for approximate set
membership testing that supports additions and deletions.
- Tests: spec/dataStructures/cuckoo-filter.spec.js
4. Distributed Fixed Window Rate Limiter:
- Location: lib/algorithms/networking/distributed-fixed-window-rate-limiter.js
- Description: Implements fixed window rate limiting logic adaptable
for distributed systems (e.g., using Redis). Includes an in-memory
store adapter for standalone use/testing.
- Tests: spec/algo/networking/distributed-fixed-window-rate-limiter.spec.js
5. Concave Hull (k-Nearest Neighbors based):
- Location: lib/algorithms/geospatial/concave-hull-knn.js
- Description: Generates a non-convex polygon representing the shape
of a 2D point set, using a k-NN approach.
- Tests: spec/algo/geospatial/concave-hull-knn.spec.js
All implementations include JSDoc documentation and error handling.
The README.md has been updated with descriptions and usage examples for
each new algorithm.
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.
No description provided.