( directory: string, ignoreContent: string, maxDepth?: number, )
| 16 | * or ignore rules change. |
| 17 | */ |
| 18 | export const getCacheKey = ( |
| 19 | directory: string, |
| 20 | ignoreContent: string, |
| 21 | maxDepth?: number, |
| 22 | ): string => { |
| 23 | const hash = crypto.createHash('sha256'); |
| 24 | hash.update(directory); |
| 25 | hash.update(ignoreContent); |
| 26 | if (maxDepth !== undefined) { |
| 27 | hash.update(String(maxDepth)); |
| 28 | } |
| 29 | return hash.digest('hex'); |
| 30 | }; |
| 31 | |
| 32 | /** |
| 33 | * Reads cached data from the in-memory cache. |
no test coverage detected