* Computes a simple numeric hash of a string for analytics grouping. * Uses djb2 algorithm, returning a 32-bit unsigned integer.
(str: string)
| 128 | * Uses djb2 algorithm, returning a 32-bit unsigned integer. |
| 129 | */ |
| 130 | function hashString(str: string): number { |
| 131 | let hash = 5381 |
| 132 | for (let i = 0; i < str.length; i++) { |
| 133 | hash = ((hash << 5) + hash + str.charCodeAt(i)) | 0 |
| 134 | } |
| 135 | return hash >>> 0 |
| 136 | } |
| 137 | |
| 138 | export type ImageDimensions = { |
| 139 | originalWidth?: number |
no outgoing calls
no test coverage detected