react-hexgrid icon indicating copy to clipboard operation
react-hexgrid copied to clipboard

Text should accept number

Open lippyDesign opened this issue 6 years ago • 2 comments
trafficstars

Text should be accepting numbers as well as strings. Numbers are easily rendered, why not accept them? By converting my numbers to strings I first have to check if number is defined, wasting CPU ticks

lippyDesign avatar May 30 '19 00:05 lippyDesign

you can use implicit type coercion, ( +'' ) as per: let number_twelve = 12 let string_twelve = number_twelve + ''

console.log(typeof(number_twelve)) // number console.log(typeof(string_twelve)) // string

eghan avatar May 30 '19 00:05 eghan

Thank you for the quick response. I think allowing numbers should be okay though. Or is there any other reason why they are not allowed?

lippyDesign avatar May 30 '19 04:05 lippyDesign