react-use-countdown/src/sample2.ts

12 lines
241 B
TypeScript
Raw Normal View History

2020-08-28 15:36:20 +07:00
const sqrt = (n : number): number | undefined => {
if( typeof n === "undefined" || n === null){
return undefined
}
if(typeof n !== "number"){
return undefined
}
return Math.sqrt(n)
}
export default sqrt