Closed Portur closed 1 year ago
There are a couple of levels you could check here, but I don't think you want to fully validate without the library.
typeof string === 'string' && /^8[0-9a-f]{14}$/.test(string)
- this just validates that the input string is a hexidecimal string of the appropriate length, and checks the first 8 bits for the expected value (which is the same for all cell indexes, but different for edge indexes or vertex indexes).0-121
res
index digits (defined by 3-bit sequences) to be 0-6
7
6
index digits in a child position. This requires knowing which twelve base cells are pentagons, and looking for the first non-pentagon child digit.Thank you very much for the explanation.
I think then I'm going to rely on the library to be safe.
Have a great day.
Hi,
I need to define what a valid h3 index looks like before touching the library. Ideally I'm looking for a javascript function approach like
isValidID('8ff....')
.The purpose is simply to validate the
string
value within the bounds ofh3
. From my understanding, using the existingisValidCell
function would provide valid way to test this, however this would need the library.Is there an approach to this without the library?
something like
Thanks