import { fromIshToString } from '../../string/fromIshToString'
import { isNumber } from '../check/isNumber'
function fromIshToNumber(x: string | number) {
/**
* @todo
* 10px -> 10
* 10 -> 10
* remove special characters (1 0 px -> 10)
* return as Number data type
*/
if (isNumber(x)) {
return x
}
const validNumberString = fromIshToString(x)
const formatNumber = validNumberString.replace(/[^0-9-.]+/, '')
return +formatNumber
}
export { fromIshToNumber }
export default fromIshToNumber