npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@util.js/emails

v0.41.3

Published

JavaScript utility methods for emails

Downloads

29

Readme

@util.js/emails

JavaScript utility methods for emails

@util.js/emails is part of Util.js.

Classes

Emails

JavaScript utility methods for emails

Kind: global class
Access: public

emails.isValidEmail(string) ⇒ boolean

Returns whether the given string is a valid email.

The regular expression used to validate strings comes from a W3C article.

Kind: instance method of Emails
Returns: boolean - true if the given string is a valid email or false otherwise
Access: public

| Param | Type | Description | | ------ | ------------------- | ------------------ | | string | string | The string to test |

emails.wrapHeaders(nameValueArrayOfHeaders) ⇒ EmailHeaders

Wraps the given nameValueArrayOfHeaders inside an object that makes email-header lookup easy.

When using the returned object, you no longer have to worry about the case (e.g., "In-Reply-To" or "In-reply-to") of email headers.

googleapis's interface to Gmail returns email headers as an array of name-value objects. The following is a sample:

Kind: instance method of Emails
Returns: EmailHeaders - A new EmailHeaders instance
Throws:

  • TypeError If nameValueArrayOfHeaders is not an array-like object containing name-value objects

Access: public

| Param | Type | Description | | ----------------------- | ------------------ | ------------------------------------------------------- | | nameValueArrayOfHeaders | Array | An array of name-value objects containing email headers |

EmailHeaders

Wrapper of email headers that makes header lookup easy.

This class makes it so that the case of header names is not important. For example, Gmail might use "In-Reply-To" whereas iCloud might use "In-reply-to".

Kind: global class
Access: public

emailHeaders.deliveredTo() ⇒ undefined | string

Returns the value of the Delivered-To header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the Date header as a string or undefined
Access: public

emailHeaders.date() ⇒ undefined | string

Returns the value of the Date header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the Date header as a string or undefined
Access: public

emailHeaders.from() ⇒ undefined | string

Returns the value of the From header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the From header as a string or undefined
Access: public

emailHeaders.get(headerName) ⇒ undefined | string

Returns the value of the given headerName

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the given header name as a string or undefined
Throws:

  • TypeError If headerName does not have a toLowerCase function

Access: public

| Param | Type | Description | | ---------- | ------------------- | --------------------------------- | | headerName | string | The header to look up a value for |

emailHeaders.inReplyTo() ⇒ undefined | string

Returns the value of the In-Reply-To header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the In-Reply-To header as a string or undefined
Access: public

emailHeaders.messageId() ⇒ undefined | string

Returns the value of the Message-Id header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the Message-Id header as a string or undefined
Access: public

emailHeaders.references() ⇒ undefined | string

Returns the value of the References header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the References header as a string or undefined
Access: public

emailHeaders.subject() ⇒ undefined | string

Returns the value of the Subject header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the Subject header as a string or undefined
Access: public

emailHeaders.to() ⇒ undefined | string

Returns the value of the To header

Kind: instance method of EmailHeaders
Returns: undefined | string - The value of the To header as a string or undefined
Access: public

emailHeaders.toString() ⇒ string

Returns a string listing the email-header names and values of this object

Kind: instance method of EmailHeaders
Returns: string - A string representation of this object
Access: public