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

@helpdotcom/is

Package Overview
Dependencies
Maintainers
15
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helpdotcom/is - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 2017-03-02, Version 2.1.0 (Stable)
* [[1451e498b3](https://git.help.com/common-backend/is/commit/1451e498b3)] - **(SEMVER-MINOR)** is: add isEmailAllowName() (Evan Lucas) [CHAT-2199](https://helpdotcom.atlassian.net/browse/CHAT-2199)
# 2017-02-22, Version 2.0.2 (Stable)

@@ -2,0 +6,0 @@

@@ -5,2 +5,6 @@ 'use strict'

const emailRE = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}$/
const EMAIL_NAME_RE = new RegExp('^[a-z\\d!#\\$%&\'\\*\\+\\-\\/=\\?\\^_"`{\\|'
+ '}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]+[a-z\\d!#\\$%&\'\\*'
+ '\\+\\-\\/=\\?\\^_`{\\|}~\\.\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-'
+ '\\uFFEF\\s]*<(.+)>$', 'i')
const uuidRE = new RegExp('^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]' +

@@ -23,2 +27,12 @@ '{3}-[89ABab][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$')

exports.isEmailAllowName = function isEmailAllowName(s) {
if (typeof s !== 'string') return false
const match = s.match(EMAIL_NAME_RE)
if (match) {
return exports.isEmail(match[1])
}
return exports.isEmail(s)
}
// TODO(evanlucas) benchmark the difference between the current implementation

@@ -25,0 +39,0 @@ // and using a a custom implementation.

2

package.json
{
"name": "@helpdotcom/is",
"version": "2.0.2",
"version": "2.1.0",
"description": "isDate, isUUID, and isEmail for use with help-gen",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -37,2 +37,15 @@ # is

### isEmailAllowName(s)
* `s` [`<String>`][] The email string
Returns `true` if `s` is a valid email address with an optional name.
Otherwise, returns `false`.
The following formats are supported:
* `evan.lucas@help.com`
* `Evan Lucas <evan.lucas@help.com>`
* `"Evan Lucas" <evan.lucas@help.com>`
### isUUID(s)

@@ -39,0 +52,0 @@

@@ -43,2 +43,12 @@ 'use strict'

test('isEmailAllowName', (t) => {
const is = helpIs.isEmailAllowName
t.equal(is(null), false)
t.equal(is('evan@me.com'), true)
t.equal(is('Evan <evan@me.com>'), true)
t.equal(is('"Evan" <evan@me.com>'), true)
t.equal(is('Evan <evan@me.com'), false)
t.end()
})
test('isUUID', (t) => {

@@ -45,0 +55,0 @@ const is = helpIs.isUUID

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