Skip to content

toInt

Convert a value to an int if possible

157 bytes

Usage

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

import * as _ from 'radashi'
_.toInt(0) // => 0
_.toInt(null) // => 0
_.toInt(null, 3) // => 3