(s: string)
| 11 | * @param {String} s number format string, like `"123"`, `"-1000123123123123123123"` |
| 12 | */ |
| 13 | export function isSafeNumberString(s: string) { |
| 14 | if (s[0] === '-') { |
| 15 | s = s.substring(1); |
| 16 | } |
| 17 | if (s.length < MAX_SAFE_INTEGER_STR_LENGTH || |
| 18 | (s.length === MAX_SAFE_INTEGER_STR_LENGTH && s <= MAX_SAFE_INTEGER_STR)) { |
| 19 | return true; |
| 20 | } |
| 21 | return false; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Convert string to Number if string in safe Number scope. |
no outgoing calls
no test coverage detected
searching dependent graphs…