(prim)
| 582 | // type is a string, number, bigint or boolean. The reason is that those values |
| 583 | // can match lots of different string values (e.g., 1n == '+00001'). |
| 584 | function findLooseMatchingPrimitives(prim) { |
| 585 | switch (typeof prim) { |
| 586 | case 'undefined': |
| 587 | return null; |
| 588 | case 'object': // Only pass in null as object! |
| 589 | return undefined; |
| 590 | case 'symbol': |
| 591 | return false; |
| 592 | case 'string': |
| 593 | prim = +prim; |
| 594 | // Loose equal entries exist only if the string is possible to convert to |
| 595 | // a regular number and not NaN. |
| 596 | // Fall through |
| 597 | case 'number': |
| 598 | // Check for NaN |
| 599 | // eslint-disable-next-line no-self-compare |
| 600 | if (prim !== prim) { |
| 601 | return false; |
| 602 | } |
| 603 | } |
| 604 | return true; |
| 605 | } |
| 606 | |
| 607 | function setMightHaveLoosePrim(a, b, prim) { |
| 608 | const altValue = findLooseMatchingPrimitives(prim); |
no outgoing calls
no test coverage detected