smartystreets-javascript-sdk
Advanced tools
Comparing version 3.1.0 to 3.2.0
@@ -21,3 +21,3 @@ const SmartySDK = require("smartystreets-javascript-sdk"); | ||
let lookup1 = new Lookup(40.27644, -111.65747); | ||
let lookup1 = new Lookup(40.27644, -111.65747, "all"); | ||
@@ -27,3 +27,3 @@ await handleResponse(lookup1); | ||
function displayResult(result) { | ||
console.log(result.result[0].address); | ||
console.log(result.response.results[0].address); | ||
} | ||
@@ -30,0 +30,0 @@ |
{ | ||
"name": "smartystreets-javascript-sdk", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Quick and easy Smarty address validation.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -9,5 +9,6 @@ const Response = require("./Response"); | ||
class Lookup { | ||
constructor(latitude, longitude) { | ||
constructor(latitude, longitude, source="") { | ||
this.latitude = latitude.toFixed(8); | ||
this.longitude = longitude.toFixed(8); | ||
this.source = source; | ||
this.response = new Response(); | ||
@@ -14,0 +15,0 @@ } |
@@ -17,2 +17,3 @@ /** | ||
this.address.zipcode = responseData.address.zipcode; | ||
this.address.source = responseData.address.source | ||
} | ||
@@ -19,0 +20,0 @@ |
@@ -37,3 +37,4 @@ module.exports = { | ||
"longitude": "longitude", | ||
"source": "source" | ||
} | ||
}; |
@@ -33,3 +33,4 @@ const chai = require("chai"); | ||
"state_abbreviation": "UT", | ||
"zipcode": "84606" | ||
"zipcode": "84606", | ||
"source": "postal" | ||
} | ||
@@ -41,3 +42,3 @@ }, | ||
const client = new Client(mockSender); | ||
let lookup = new Lookup(44.888888888, -111.111111111); | ||
let lookup = new Lookup(44.888888888, -111.111111111, "postal"); | ||
@@ -44,0 +45,0 @@ return client.send(lookup).then(() => { |
@@ -7,4 +7,5 @@ const chai = require("chai"); | ||
it("correctly populates fields.", function () { | ||
let lookup = new Lookup(44.888888888, -111.111111111); | ||
let lookup = new Lookup(44.888888888, -111.111111111, "postal"); | ||
expect(lookup.source).to.equal("postal") | ||
expect(lookup.latitude).to.equal("44.88888889"); | ||
@@ -11,0 +12,0 @@ expect(lookup.longitude).to.equal("-111.11111111"); |
@@ -21,3 +21,4 @@ const chai = require("chai"); | ||
state_abbreviation: "7", | ||
zipcode: "8" | ||
zipcode: "8", | ||
source: "postal" | ||
} | ||
@@ -37,2 +38,3 @@ }, | ||
expect(address.zipcode).to.equal("8"); | ||
expect(address.source).to.equal("postal"); | ||
let coordinate = result.coordinate; | ||
@@ -39,0 +41,0 @@ expect(coordinate.latitude).to.equal(1.1); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
172853
3962