New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More β†’
Socket
Sign inDemoInstall
Socket

postal-mime

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postal-mime - npm Package Compare versions

Comparing version 2.2.3 to 2.2.4

7

CHANGELOG.md
# Changelog
## [2.2.4](https://github.com/postalsys/postal-mime/compare/v2.2.3...v2.2.4) (2024-04-11)
### Bug Fixes
* **exports:** Export addressParser and decodeWords functions ([43d3187](https://github.com/postalsys/postal-mime/commit/43d31873308d8eff61876f32614e5cc5143c90dd))
## [2.2.3](https://github.com/postalsys/postal-mime/compare/v2.2.2...v2.2.3) (2024-04-11)

@@ -4,0 +11,0 @@

2

package.json
{
"name": "postal-mime",
"version": "2.2.3",
"version": "2.2.4",
"description": "Email parser for browser environments",

@@ -5,0 +5,0 @@ "main": "./src/postal-mime.js",

@@ -41,2 +41,15 @@ export type RawEmail = string | ArrayBuffer | Uint8Array | Blob | Buffer | ReadableStream;

declare type AddressParserOptions = {
flatten?: boolean
}
declare function addressParser (
str: string,
opts?: AddressParserOptions
): Address[];
declare function decodeWords (
str: string
): string;
declare class PostalMime {

@@ -47,2 +60,3 @@ static parse(email: RawEmail): Promise<Email>;

export { addressParser, decodeWords };
export default PostalMime;

@@ -126,2 +126,53 @@ # postal-mime

### Utility functions
#### addressParser
Parse email address strings
```js
addressParser(addressStr, opts) -> Array
```
where
- **addressStr** is the header value for an address header
- **opts** is an optional options object
- **flattem** is a boolean value. If set to `true`, then ignores address groups and returns a flat array of addresses. By default (`flatten` is `false`) the result might include nested groups
The result is an array of objects
- **name** is the name string. An empty string is used if name value was not set.
- **address** is the email address value
```js
import { addressParser } from 'postal-mime';
const addressStr = '=?utf-8?B?44Ko44Od44K544Kr44O844OJ?= <support@example.com>';
console.log(addressParser(addressStr));
// [ { name: 'エポスカード', address: 'support@example.com' } ]
```
#### decodeWords
Decode MIME encoded-words
```js
decodeWords(encodedStr) -> String
```
where
- **encodedStr** is a string value that _may_ include MIME encoded-words
The result is a unicode string
```js
import { decodeWords } from 'postal-mime';
const encodedStr = 'Hello, =?utf-8?B?44Ko44Od44K544Kr44O844OJ?=';
console.log(decodeWords(encodedStr));
// Hello, エポスカード
```
## License

@@ -128,0 +179,0 @@

@@ -6,2 +6,4 @@ import MimeNode from './mime-node.js';

export { addressParser, decodeWords };
export default class PostalMime {

@@ -8,0 +10,0 @@ static parse(buf) {

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