1- const SmartySDK = require ( "../dist/cjs/index.cjs " ) ;
1+ const SmartySDK = require ( "smartystreets-javascript-sdk " ) ;
22const SmartyCore = SmartySDK . core ;
33const Lookup = SmartySDK . internationalStreet . Lookup ;
44
@@ -23,26 +23,25 @@ let client = clientBuilder.buildInternationalStreetClient();
2323// https://www.smarty.com/docs/cloud/international-street-api#http-input-fields
2424
2525let lookup1 = new Lookup ( "CA" , "262 Browndale Cr, Richmond Hill, ON" ) ;
26+ // uncomment the following line to add a custom parameter
2627// lookup1.addCustomParameter("input_id", 1234);
27- // lookup1.addCustomParameter("geocode", true);
28-
29- // let lookup2 = new Lookup();
30- // lookup2.geocode = false;
31- // lookup2.organization = "John Doe";
32- // lookup2.address1 = "Rua Padre Antonio D'Angelo 121";
33- // lookup2.address2 = "Casa Verde";
34- // lookup2.locality = "Sao Paulo";
35- // lookup2.administrativeArea = "SP";
36- // lookup2.country = "Brazil";
37- // lookup2.postalCode = "02516-050";
38-
39- ( async ( ) => {
40- await handleRequest ( lookup1 ) ;
41- } ) ( ) ;
42- // await handleRequest(lookup2)
28+
29+ let lookup2 = new Lookup ( ) ;
30+ lookup2 . inputId = "ID-8675309" ;
31+ lookup2 . geocode = false ;
32+ lookup2 . organization = "John Doe" ;
33+ lookup2 . address1 = "Rua Padre Antonio D'Angelo 121" ;
34+ lookup2 . address2 = "Casa Verde" ;
35+ lookup2 . locality = "Sao Paulo" ;
36+ lookup2 . administrativeArea = "SP" ;
37+ lookup2 . country = "Brazil" ;
38+ lookup2 . postalCode = "02516-050" ;
39+
40+ await handleRequest ( lookup1 )
41+ await handleRequest ( lookup2 )
4342
4443function displayResult ( result ) {
45- // console.log(result);
44+ console . log ( result . result [ 0 ] . components ) ;
4645}
4746
4847function handleError ( error ) {
0 commit comments