( ruleId: string, options: unknown[] | undefined, )
| 7 | } |
| 8 | |
| 9 | export function ruleIdToSlug( |
| 10 | ruleId: string, |
| 11 | options: unknown[] | undefined, |
| 12 | ): string { |
| 13 | const slug = slugify(ruleId); |
| 14 | if (!options?.length) { |
| 15 | return slug; |
| 16 | } |
| 17 | return `${slug}-${jsonHash(options)}`; |
| 18 | } |
| 19 | |
| 20 | export function jsonHash(data: unknown, bytes = 8): string { |
| 21 | return createHash('shake256', { outputLength: bytes }) |
no test coverage detected