address-rfc2822
Advanced tools
Comparing version 2.2.2 to 2.2.3
@@ -7,2 +7,6 @@ # Changelog | ||
### [2.2.3] - 2025-01-13 | ||
- dep(eslint): upgrade to v9 | ||
### [2.2.2] - 2024-04-29 | ||
@@ -91,1 +95,2 @@ | ||
[2.2.2]: https://github.com/haraka/node-address-rfc2822/releases/tag/v2.2.2 | ||
[2.2.3]: https://github.com/haraka/node-address-rfc2822/releases/tag/v2.2.3 |
11
index.js
@@ -43,6 +43,4 @@ 'use strict' | ||
if (!addr) throw new Error('No results') | ||
if (!addr || addr.length === 0) throw new Error('No results') | ||
// console.log("Parsed to: ", require('util').inspect(addr, {depth: 10, colors: true})); | ||
return addr.addresses.map(map_addresses) | ||
@@ -97,4 +95,3 @@ } | ||
const name = _extract_name(phrase) | ||
return name | ||
return _extract_name(phrase) | ||
} | ||
@@ -238,3 +235,3 @@ } | ||
// trim & condense whitespace | ||
name = name.trim().replace(/\s+/, ' ') | ||
name = name.trim().replace(/\s+/g, ' ') | ||
@@ -253,3 +250,3 @@ // Disregard numeric names (e.g. 123456.1234@compuserve.com) | ||
name = name | ||
.replace(/\(.*?\)/g, '') // remove minimal embedded comments | ||
.replace(/\([^)]*\)/g, '') // remove minimal embedded comments | ||
.replace(/\\/g, '') // remove all escapes | ||
@@ -256,0 +253,0 @@ |
{ | ||
"name": "address-rfc2822", | ||
"version": "2.2.2", | ||
"version": "2.2.3", | ||
"description": "RFC 2822 & 5322 (Header) email address parser", | ||
@@ -21,4 +21,4 @@ "main": "index.js", | ||
"format": "npm run prettier:fix && npm run lint:fix", | ||
"lint": "npx eslint@^8 *.js test", | ||
"lint:fix": "npx eslint@^8 *.js test --fix", | ||
"lint": "npx eslint *.js test", | ||
"lint:fix": "npx eslint *.js test --fix", | ||
"prettier": "npx prettier . --check", | ||
@@ -35,3 +35,3 @@ "prettier:fix": "npx prettier . --write --log-level=warn", | ||
"devDependencies": { | ||
"@haraka/eslint-config": "1.1.5" | ||
"@haraka/eslint-config": "2.0.2" | ||
}, | ||
@@ -38,0 +38,0 @@ "license": "MIT", |
12984
223