Skip to content

Commit 1e1c0f1

Browse files
authored
Merge pull request #293 from OwenMelbz/patch-1
bug fixed validation on props
2 parents 9fc9e9c + 3c2710e commit 1e1c0f1

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/utils.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -186,19 +186,14 @@ export const checkOptions = ({
186186
prefixes: Record<string, string>;
187187
appsWhiteList: string[] | null | undefined;
188188
}): void => {
189-
if (!latitude || !longitude) {
189+
if (!(latitude && longitude) && !address) {
190190
throw new MapsException(
191-
'`showLocation` should contain keys `latitude` and `longitude`.',
191+
'`latitude` & `longitude` or `address` is required. Both cannot be undefined.',
192192
);
193193
}
194194
if (address && typeof address !== 'string') {
195195
throw new MapsException('Option `address` should be of type `string`.');
196196
}
197-
if (!latitude && !longitude && !address) {
198-
throw new MapsException(
199-
'`latitude` & `longitude` or `address` is required. Both cannot be undefined.',
200-
);
201-
}
202197
if (title && typeof title !== 'string') {
203198
throw new MapsException('`title` should be of type `string`.');
204199
}

0 commit comments

Comments
 (0)