(n: number)
| 318 | * @since 2.0.0 |
| 319 | */ |
| 320 | export const number = (n: number) => { |
| 321 | if (n !== n) { |
| 322 | return string("NaN") |
| 323 | } |
| 324 | if (n === Infinity) { |
| 325 | return string("Infinity") |
| 326 | } |
| 327 | if (n === -Infinity) { |
| 328 | return string("-Infinity") |
| 329 | } |
| 330 | let h = n | 0 |
| 331 | if (h !== n) { |
| 332 | h ^= n * 0xffffffff |
| 333 | } |
| 334 | while (n > 0xffffffff) { |
| 335 | h ^= n /= 0xffffffff |
| 336 | } |
| 337 | return optimize(h) |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Computes a hash value for a string using the djb2 algorithm. |
no test coverage detected