* [Numberic is defined as]: * `parseFloat(val) == val` * For example: * numeric: * typeof number except NaN, '-123', '123', '2e3', '-2e3', '011', 'Infinity', Infinity, * and they rounded by white-spaces or line-terminal like ' -123 \n ' (see es spec) * not-n
(val)
| 7058 | */ |
| 7059 | |
| 7060 | function numericToNumber(val) { |
| 7061 | var valFloat = parseFloat(val); |
| 7062 | return valFloat == val // eslint-disable-line eqeqeq |
| 7063 | && (valFloat !== 0 || typeof val !== 'string' || val.indexOf('x') <= 0) // For case ' 0x0 '. |
| 7064 | ? valFloat : NaN; |
| 7065 | } |
| 7066 | /** |
| 7067 | * Definition of "numeric": see `numericToNumber`. |
| 7068 | */ |
no outgoing calls
no test coverage detected
searching dependent graphs…