Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

smartystreets-javascript-sdk-utils

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smartystreets-javascript-sdk-utils - npm Package Compare versions

Comparing version 1.1.8 to 1.1.9

2

package.json
{
"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);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc