@@ -261,7 +261,7 @@ validateAvoid <- function(avoid){
261261validateBounds <- function (bounds ){
262262 if (is.null(bounds )) return (NULL )
263263
264- if (! class (bounds ) == " list" | ! all(sapply(bounds , class ) == " numeric" ) | length(bounds ) != 2 )
264+ if (! is (bounds , " list" ) | ! all(sapply(bounds , inherits , " numeric" ) ) | length(bounds ) != 2 )
265265 stop(" bounds must be a list of length 2, each item being a vector of lat/lon coordinate pairs" )
266266
267267 if (! all(sapply(bounds , length ) == 2 ))
@@ -381,7 +381,7 @@ validateLocationBias <- function( point, circle, rectangle ) {
381381validateLanguage <- function (language ){
382382 if (is.null(language )) return (NULL )
383383
384- if (class (language ) != " character" | length(language ) > 1 ){
384+ if (! is (language , " character" ) | length(language ) > 1 ){
385385 stop(" language must be a single string" )
386386 }
387387 return (tolower(language ))
@@ -614,7 +614,7 @@ validateRankBy <- function(rankby, location, search_string){
614614validateRegion <- function (region ){
615615 if (is.null(region )) return (NULL )
616616
617- if (class (region ) != " character" | length(region ) > 1 )
617+ if (! is (region , " character" ) | length(region ) > 1 )
618618 stop(" region must be a two-character string" )
619619
620620 return (tolower(region ))
@@ -623,7 +623,7 @@ validateRegion <- function(region){
623623validateResultType <- function (result_type ){
624624 if (is.null(result_type )) return (NULL )
625625
626- if (! class (result_type ) == " character" )
626+ if (! is (result_type , " character" ) )
627627 stop(" result_type must be a vector of strings" )
628628
629629 if (length(result_type ) > 1 ){
@@ -687,7 +687,7 @@ validateWaypoints <- function(waypoints, optimise_waypoints, mode){
687687 if (! mode %in% c(" driving" , " walking" ," bicycling" ))
688688 stop(" waypoints are only valid for driving, walking or bicycling modes" )
689689
690- if (class (waypoints ) != " list" )
690+ if (! is (waypoints , " list" ) )
691691 stop(" waypoints must be a list" )
692692
693693 if (! all(names(waypoints ) %in% c(" stop" , " via" )))
0 commit comments