5 lines
132 B
JavaScript
5 lines
132 B
JavaScript
import isFloat from './isFloat';
|
|
export default function toFloat(str) {
|
|
if (!isFloat(str)) return NaN;
|
|
return parseFloat(str);
|
|
} |