Basic usage

The _.toInt function will do its best to convert the given value to an int.

import { toInt } from 'radash'

toInt(0) // => 0
toInt(null) // => 0
toInt(null, 3) // => 3

Testing

This _.toInt function is 100% covered by tests. See them and contribute at GitHub.

Source

See the source for _.toInt on GitHub.