Skip to content

Commit

Permalink
[utils] [new] hash: add support for hashing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfaith authored and ljharb committed Sep 26, 2024
1 parent 3fbe10f commit 468321a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange

## Unreleased

### Added
- `hash`: add support for hashing functions ([#3072], thanks [@michaelfaith])

## v2.11.1 - 2024-09-23

### Fixed
Expand Down Expand Up @@ -172,6 +175,7 @@ Yanked due to critical issue with cache key resulting from #839.
### Fixed
- `unambiguous.test()` regex is now properly in multiline mode

[#3072]: https://github.com/import-js/eslint-plugin-import/pull/3072
[#3061]: https://github.com/import-js/eslint-plugin-import/pull/3061
[#3057]: https://github.com/import-js/eslint-plugin-import/pull/3057
[#3049]: https://github.com/import-js/eslint-plugin-import/pull/3049
Expand Down
2 changes: 2 additions & 0 deletions utils/hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ function hashify(value, hash) {

if (Array.isArray(value)) {
hashArray(value, hash);
} else if (typeof value === 'function') {
hash.update(String(value));
} else if (value instanceof Object) {
hashObject(value, hash);
} else {
Expand Down

0 comments on commit 468321a

Please sign in to comment.