@@ -22,8 +22,7 @@ const processApiResponse = (apiResponse) =>
22
22
* @param {string } zip_code
23
23
*/
24
24
25
-
26
- const validateArguments = ( apiKey , address , countryCode = null ) => {
25
+ const validateArguments = ( apiKey , address , countryCode , isInternational ) => {
27
26
if ( ! Object . keys ( address || { } ) . length ) {
28
27
return new Error ( 'Empty address was passed to verify function' )
29
28
}
@@ -32,7 +31,7 @@ const validateArguments = (apiKey, address, countryCode = null) => {
32
31
return new Error ( 'Missing API key' )
33
32
}
34
33
35
- if ( countryCode ) {
34
+ if ( isInternational ) {
36
35
if ( typeof countryCode !== 'string' ) {
37
36
return new Error ( 'Expected countryCode to be of type string' )
38
37
}
@@ -55,7 +54,7 @@ const validateArguments = (apiKey, address, countryCode = null) => {
55
54
* https://docs.lob.com/#operation/us_verification
56
55
*/
57
56
export const verify = ( apiKey , address ) => {
58
- const error = validateArguments ( apiKey , address )
57
+ const error = validateArguments ( apiKey , address , null , false )
59
58
if ( error ) {
60
59
return Promise . reject ( error )
61
60
}
@@ -87,7 +86,8 @@ export const verify = (apiKey, address) => {
87
86
* https://docs.lob.com/#operation/us_verification
88
87
*/
89
88
export const verifyInternational = ( apiKey , address , countryCode ) => {
90
- const error = validateArguments ( apiKey , address , countryCode )
89
+ const error = validateArguments ( apiKey , address , countryCode , true )
90
+
91
91
if ( error ) {
92
92
return Promise . reject ( error )
93
93
}
0 commit comments