Skip to content

toFloat

Convert a value to a float if possible

161 bytes

Usage

The _.toFloat function will do its best to convert the given value to a float.

import * as _ from 'radashi'
_.toFloat(0) // => 0.0
_.toFloat(null) // => 0.0
_.toFloat(null, 3.33) // => 3.33