@@ -261,11 +261,7 @@ SUBCOMMAND(getResolution, "Extracts the resolution (0 - 15) from the H3 cell") {
261261 DEFINE_CELL_ARG (cell , cellArg );
262262 Arg * args [] = {& getResolutionArg , & helpArg , & cellArg };
263263 PARSE_SUBCOMMAND (argc , argv , args );
264- // TODO: Should there be a general `isValidIndex`?
265- bool isValid = H3_EXPORT (isValidCell )(cell ) ||
266- H3_EXPORT (isValidDirectedEdge )(cell ) ||
267- H3_EXPORT (isValidVertex )(cell );
268- if (!isValid ) {
264+ if (!H3_EXPORT (isValidIndex )(cell )) {
269265 return E_DOMAIN ; // TODO: maybe create a new E_INDEX_INVALID error?
270266 }
271267 // If we got here, we can use `getResolution` safely, as this is one of the
@@ -281,11 +277,7 @@ SUBCOMMAND(getBaseCellNumber,
281277 DEFINE_CELL_ARG (cell , cellArg );
282278 Arg * args [] = {& getBaseCellNumberArg , & helpArg , & cellArg };
283279 PARSE_SUBCOMMAND (argc , argv , args );
284- // TODO: Should there be a general `isValidIndex`?
285- bool isValid = H3_EXPORT (isValidCell )(cell ) ||
286- H3_EXPORT (isValidDirectedEdge )(cell ) ||
287- H3_EXPORT (isValidVertex )(cell );
288- if (!isValid ) {
280+ if (!H3_EXPORT (isValidIndex )(cell )) {
289281 return E_DOMAIN ; // TODO: maybe create a new E_INDEX_INVALID error?
290282 }
291283 // If we got here, we can use `getResolution` safely, as this is one of the
@@ -308,11 +300,7 @@ SUBCOMMAND(getIndexDigit,
308300 .helpText = "Indexing resolution (1 - 15)" };
309301 Arg * args [] = {& getIndexDigitArg , & helpArg , & cellArg , & digitArg };
310302 PARSE_SUBCOMMAND (argc , argv , args );
311- // TODO: Should there be a general `isValidIndex`?
312- bool isValid = H3_EXPORT (isValidCell )(cell ) ||
313- H3_EXPORT (isValidDirectedEdge )(cell ) ||
314- H3_EXPORT (isValidVertex )(cell );
315- if (!isValid ) {
303+ if (!H3_EXPORT (isValidIndex )(cell )) {
316304 return E_DOMAIN ; // TODO: maybe create a new E_INDEX_INVALID error?
317305 }
318306 int value ;
@@ -387,11 +375,7 @@ SUBCOMMAND(isResClassIII,
387375 DEFINE_CELL_ARG (cell , cellArg );
388376 Arg * args [] = {& isResClassIIIArg , & helpArg , & cellArg , & formatArg };
389377 PARSE_SUBCOMMAND (argc , argv , args );
390- // TODO: Should there be a general `isValidIndex`?
391- bool isValid = H3_EXPORT (isValidCell )(cell ) ||
392- H3_EXPORT (isValidDirectedEdge )(cell ) ||
393- H3_EXPORT (isValidVertex )(cell );
394- if (!isValid ) {
378+ if (!H3_EXPORT (isValidIndex )(cell )) {
395379 return E_DOMAIN ; // TODO: maybe create a new E_INDEX_INVALID error?
396380 }
397381 // If we got here, we can use `getResolution` safely, as this is one of the
@@ -416,11 +400,7 @@ SUBCOMMAND(
416400 DEFINE_CELL_ARG (cell , cellArg );
417401 Arg * args [] = {& isPentagonArg , & helpArg , & cellArg , & formatArg };
418402 PARSE_SUBCOMMAND (argc , argv , args );
419- // TODO: Should there be a general `isValidIndex`?
420- bool isValid = H3_EXPORT (isValidCell )(cell ) ||
421- H3_EXPORT (isValidDirectedEdge )(cell ) ||
422- H3_EXPORT (isValidVertex )(cell );
423- if (!isValid ) {
403+ if (!H3_EXPORT (isValidIndex )(cell )) {
424404 return E_DOMAIN ; // TODO: maybe create a new E_INDEX_INVALID error?
425405 }
426406 // If we got here, we can use `getResolution` safely, as this is one of the
0 commit comments