usps-webtools-promise
Advanced tools
Comparing version 3.1.4 to 4.0.2
@@ -21,3 +21,3 @@ "use strict"; | ||
try { | ||
response = (await request_1.default("Verify", "AddressValidate", "Address", this.config, { | ||
response = (await (0, request_1.default)("Verify", "AddressValidate", "Address", this.config, { | ||
Revision: 1, | ||
@@ -32,10 +32,10 @@ Address: parameters, | ||
response.Address1 = response.Address1 | ||
? proper_case_1.default(response.Address1) | ||
? (0, proper_case_1.default)(response.Address1) | ||
: undefined; | ||
response.Address2 = response.Address2 | ||
? proper_case_1.default(response.Address2) | ||
? (0, proper_case_1.default)(response.Address2) | ||
: undefined; | ||
response.City = response.City ? proper_case_1.default(response.City) : undefined; | ||
response.City = response.City ? (0, proper_case_1.default)(response.City) : undefined; | ||
response.FirmName = response.FirmName | ||
? proper_case_1.default(response.FirmName) | ||
? (0, proper_case_1.default)(response.FirmName) | ||
: undefined; | ||
@@ -42,0 +42,0 @@ } |
@@ -11,3 +11,3 @@ "use strict"; | ||
try { | ||
response = (await request_1.default("CityStateLookup", "CityStateLookup", "ZipCode", this.config, { | ||
response = (await (0, request_1.default)("CityStateLookup", "CityStateLookup", "ZipCode", this.config, { | ||
ZipCode: { | ||
@@ -19,3 +19,3 @@ Zip5: zip, | ||
if (this.config.properCase) { | ||
response.City = proper_case_1.default(response === null || response === void 0 ? void 0 : response.City); | ||
response.City = (0, proper_case_1.default)(response === null || response === void 0 ? void 0 : response.City); | ||
} | ||
@@ -22,0 +22,0 @@ return response; |
@@ -26,3 +26,3 @@ "use strict"; | ||
try { | ||
response = (await request_1.default("RateV4", "RateV4", "Package", this.config, parameters)); | ||
response = (await (0, request_1.default)("RateV4", "RateV4", "Package", this.config, parameters)); | ||
if (response && response.Package) { | ||
@@ -29,0 +29,0 @@ return response.Package.Postage; |
@@ -11,3 +11,3 @@ "use strict"; | ||
try { | ||
response = (await request_1.default("ZipCodeLookup", "ZipCodeLookup", "Address", this.config, { | ||
response = (await (0, request_1.default)("ZipCodeLookup", "ZipCodeLookup", "Address", this.config, { | ||
Address: { | ||
@@ -23,10 +23,10 @@ Address1: address.Address2 || "", | ||
response.Address1 = response.Address2 | ||
? proper_case_1.default(response.Address2) | ||
? (0, proper_case_1.default)(response.Address2) | ||
: undefined; | ||
response.Address2 = response.Address1 | ||
? proper_case_1.default(response.Address1) | ||
? (0, proper_case_1.default)(response.Address1) | ||
: undefined; | ||
response.City = response.City ? proper_case_1.default(response.City) : undefined; | ||
response.City = response.City ? (0, proper_case_1.default)(response.City) : undefined; | ||
response.FirmName = response.FirmName | ||
? proper_case_1.default(response.FirmName) | ||
? (0, proper_case_1.default)(response.FirmName) | ||
: undefined; | ||
@@ -33,0 +33,0 @@ } |
@@ -28,7 +28,7 @@ "use strict"; | ||
]; | ||
for (const [index, _value] of Object.keys(lowers).entries()) { | ||
for (const [index] of Object.keys(lowers).entries()) { | ||
string = string.replace(new RegExp(`\\s${lowers[index]}\\s`, "g"), (txt) => txt.toLowerCase()); | ||
} | ||
const uppers = ["Ne", "Nw", "Se", "Sw"]; | ||
for (const [index, _value] of Object.keys(uppers).entries()) { | ||
const uppers = ["Ne", "Nw", "Po", "Se", "Sw"]; | ||
for (const [index] of Object.keys(uppers).entries()) { | ||
string = string.replace(new RegExp(`\\b${uppers[index]}\\b`, "g"), (txt) => txt.toUpperCase()); | ||
@@ -35,0 +35,0 @@ } |
@@ -7,3 +7,3 @@ "use strict"; | ||
const makeRequest = async (options) => new Promise((resolve, reject) => { | ||
const innerRequest = https_1.request(options, (response) => { | ||
const innerRequest = (0, https_1.request)(options, (response) => { | ||
let body = ""; | ||
@@ -13,3 +13,3 @@ response.on("data", (chunk) => (body += chunk)); | ||
try { | ||
const xml = xmlbuilder2_1.create(body); | ||
const xml = (0, xmlbuilder2_1.create)(body); | ||
resolve(xml.end({ format: "object" })); | ||
@@ -36,4 +36,4 @@ } | ||
}; | ||
const xml = xmlbuilder2_1.create(xmlObject).end(); | ||
const qs = querystring_1.stringify({ | ||
const xml = (0, xmlbuilder2_1.create)(xmlObject).end(); | ||
const qs = (0, querystring_1.stringify)({ | ||
API: api, | ||
@@ -40,0 +40,0 @@ XML: xml, |
@@ -5,3 +5,3 @@ { | ||
"description": "API wrapper for the USPS Web-Tools, with Promises!", | ||
"version": "3.1.4", | ||
"version": "4.0.2", | ||
"main": "./dist/usps.js", | ||
@@ -39,21 +39,21 @@ "types": "./dist/usps.d.ts", | ||
"dependencies": { | ||
"xmlbuilder2": "^2.4.1" | ||
"xmlbuilder2": "^3.0.2" | ||
}, | ||
"devDependencies": { | ||
"@sparticuz/eslint-config": "^3.5.3", | ||
"@types/node": "^15.0.2", | ||
"@typescript-eslint/eslint-plugin": "^4.23.0", | ||
"@typescript-eslint/parser": "^4.23.0", | ||
"ava": "^3.15.0", | ||
"c8": "^7.7.2", | ||
"eslint": "^7.26.0", | ||
"prettier": "^2.3.0", | ||
"string.prototype.trimend": "^1.0.4", | ||
"typescript": "^4.2.4" | ||
"@rushstack/eslint-patch": "^1.1.3", | ||
"@sparticuz/eslint-config": "^6.2.0", | ||
"@types/node": "^16.11.29", | ||
"@typescript-eslint/eslint-plugin": "^5.21.0", | ||
"@typescript-eslint/parser": "^5.21.0", | ||
"ava": "^4.2.0", | ||
"c8": "^7.11.2", | ||
"eslint": "^8.14.0", | ||
"prettier": "^2.6.2", | ||
"typescript": "^4.6.3" | ||
}, | ||
"repository": "https://github.com/Sparticuz/usps-webtools-promise.git", | ||
"engines": { | ||
"node": ">=10.x" | ||
"node": ">=12.x" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -85,1 +85,19 @@ ![Node.js CI](https://github.com/Sparticuz/usps-webtools-promise/workflows/Node.js%20CI/badge.svg) ![CodeQL](https://github.com/Sparticuz/usps-webtools-promise/workflows/CodeQL/badge.svg) | ||
``` | ||
### Coverage | ||
``` | ||
-------------------------|---------|----------|---------|---------|----------------------------- | ||
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s | ||
-------------------------|---------|----------|---------|---------|----------------------------- | ||
All files | 83.91 | 57.97 | 92.3 | 83.91 | | ||
dist | 94.8 | 43.47 | 100 | 94.8 | | ||
address-validate.ts | 96.22 | 38.88 | 100 | 96.22 | 94 | ||
usps.ts | 91.66 | 60 | 100 | 91.66 | 36 | ||
dist/lookups | 68.26 | 60 | 83.33 | 68.26 | | ||
city-state-lookup.ts | 92.85 | 66.66 | 100 | 92.85 | 44 | ||
pricing-rate-lookup.ts | 19.44 | 66.66 | 50 | 19.44 | 111-148 | ||
zip-code-lookup.ts | 95 | 53.84 | 100 | 95 | 68 | ||
dist/utils | 91.42 | 71.42 | 100 | 91.42 | | ||
proper-case.ts | 100 | 100 | 100 | 100 | | ||
request.ts | 86.95 | 60 | 100 | 86.95 | 47-48,55,114-115,119-120,153 | ||
-------------------------|---------|----------|---------|---------|----------------------------- | ||
``` |
{ | ||
"compilerOptions": { | ||
"target": "es2018", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ | ||
"target": "es2019", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ | ||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ | ||
"lib": ["ES2018", "DOM"], /* Specify library files to be included in the compilation. */ | ||
"lib": ["ES2019", "DOM"], /* Specify library files to be included in the compilation. */ | ||
"declaration": true, /* Generates corresponding '.d.ts' file. */ | ||
@@ -7,0 +7,0 @@ "outDir": "./dist", /* Redirect output structure to the directory. */ |
23420
18
547
103
+ Added@oozcitak/dom@1.15.10(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedxmlbuilder2@3.1.1(transitive)
- Removed@oozcitak/dom@1.15.8(transitive)
- Removed@types/node@22.10.10(transitive)
- Removedjs-yaml@3.14.0(transitive)
- Removedundici-types@6.20.0(transitive)
- Removedxmlbuilder2@2.4.1(transitive)
Updatedxmlbuilder2@^3.0.2