smartystreets-javascript-sdk-utils
Advanced tools
Comparing version 1.1.8 to 1.1.9
{ | ||
"name": "smartystreets-javascript-sdk-utils", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "Utils library to use with the SmartyStreets Javascript SDK", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
function isInvalid ({result}) { | ||
const noResults = result.length === 0 || !result[0].analysis; | ||
const noResults = result.length === 0; | ||
@@ -20,17 +20,5 @@ if (noResults) { | ||
if (exactlyOneResult) { | ||
if (result[0].analysis?.enhanced_match) { | ||
const enhancedMatch = result[0].analysis.enhanced_match.split(","); | ||
return enhancedMatch.includes("none"); | ||
} | ||
else if (verificationStatusIsNone) return true; | ||
else if (addressPrecisionIsPreciseEnough) return true; | ||
else if (dpvMatchCodeIsN) return true; | ||
else if (undefinedDpvMatchCodeAndVerificationStatus) return true; | ||
else return !addressIsAtLeastPartiallyVerified && !addressIsConfirmedInSomeWay; | ||
} | ||
return false; | ||
return exactlyOneResult && (verificationStatusIsNone || addressPrecisionIsPreciseEnough || dpvMatchCodeIsN || undefinedDpvMatchCodeAndVerificationStatus || (!addressIsAtLeastPartiallyVerified && !addressIsConfirmedInSomeWay)); | ||
} | ||
module.exports = isInvalid; |
@@ -8,11 +8,2 @@ function isMissingSecondary ({result}) { | ||
const enhancedMatchingResponse = result[0].analysis.enhanced_match; | ||
if (enhancedMatchingResponse) { | ||
const hasMissingSecondary = enhancedMatchingResponse.includes("missing-secondary"); | ||
const hasUnknownSecondary = enhancedMatchingResponse.includes("unknown-secondary"); | ||
return hasMissingSecondary || hasUnknownSecondary; | ||
} | ||
const n1DPVFootnotePresent = result[0].analysis.dpvFootnotes && result[0].analysis.dpvFootnotes.includes("N1"); | ||
@@ -19,0 +10,0 @@ const r1DPVFootnotePresent = result[0].analysis.dpvFootnotes && result[0].analysis.dpvFootnotes.includes("R1"); |
@@ -86,22 +86,2 @@ const isInvalid = require("../src/isInvalid"); | ||
}); | ||
it("is exactly one item and enhanced match response is defined.", function () { | ||
const invalidAddress = { | ||
result: [{ | ||
analysis: { | ||
enhanced_match: "none-postal-match,postal-match,none", | ||
}, | ||
}] | ||
}; | ||
const noEnhancedMatch = { | ||
result: [{ | ||
analysis: { | ||
enhanced_match: "", | ||
}, | ||
}] | ||
}; | ||
expect(isInvalid(invalidAddress)).toEqual(true); | ||
expect(isInvalid(noEnhancedMatch)).toEqual(true); | ||
}); | ||
}); |
@@ -45,23 +45,2 @@ const isMissingSecondary = require("../src/isMissingSecondary"); | ||
}); | ||
it("is using enhanced matching", function () { | ||
const secondaryIsReturned = { | ||
result: [{ | ||
analysis: { | ||
enhanced_match: "postal-match", | ||
} | ||
}] | ||
}; | ||
const noSecondary = { | ||
result: [{ | ||
analysis: { | ||
enhanced_match: "unknown-secondary", | ||
} | ||
}] | ||
}; | ||
expect(isMissingSecondary(secondaryIsReturned)).toEqual(false); | ||
expect(isMissingSecondary(noSecondary)).toEqual(true); | ||
}) | ||
}); |
@@ -52,22 +52,2 @@ const isValid = require("../src/isValid"); | ||
}); | ||
it("is exactly one item and includes enhanced matching param.", function () { | ||
const enhancedMatchingOneResponse = { | ||
result: [{ | ||
analysis: { | ||
enhanced_match: "postal-match", | ||
}, | ||
}] | ||
}; | ||
const enhancedMatchingMultipleResponse = { | ||
result: [{ | ||
analysis: { | ||
enhanced_match: "postal-match,missing-secondary,unknown-secondary", | ||
}, | ||
}] | ||
}; | ||
expect(isInvalid(enhancedMatchingOneResponse)).toEqual(false); | ||
expect(isInvalid(enhancedMatchingMultipleResponse)).toEqual(false); | ||
}); | ||
}); |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
23992
205