Skip to content

Commit 468321a

Browse files
michaelfaithljharb
authored andcommitted
[utils] [new] hash: add support for hashing functions
1 parent 3fbe10f commit 468321a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

utils/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
55

66
## Unreleased
77

8+
### Added
9+
- `hash`: add support for hashing functions ([#3072], thanks [@michaelfaith])
10+
811
## v2.11.1 - 2024-09-23
912

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

178+
[#3072]: https://github.com/import-js/eslint-plugin-import/pull/3072
175179
[#3061]: https://github.com/import-js/eslint-plugin-import/pull/3061
176180
[#3057]: https://github.com/import-js/eslint-plugin-import/pull/3057
177181
[#3049]: https://github.com/import-js/eslint-plugin-import/pull/3049

utils/hash.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function hashify(value, hash) {
1717

1818
if (Array.isArray(value)) {
1919
hashArray(value, hash);
20+
} else if (typeof value === 'function') {
21+
hash.update(String(value));
2022
} else if (value instanceof Object) {
2123
hashObject(value, hash);
2224
} else {

0 commit comments

Comments
 (0)