Skip to content

Commit

Permalink
fix: create a new email validator every time
Browse files Browse the repository at this point in the history
I noticed half of the contributors to my project had disappeared
after the `v1.0.20` release.

You have to create a new `email-regex` with [every use](https://runkit.com/embed/g5j2gfwuae06):

```javascript
const emailRegex = require("email-regex")
const reg = emailRegex()

console.info(reg.test('[email protected]')) // true
console.info(reg.test('[email protected]')) // false
```
  • Loading branch information
achingbrain committed Feb 20, 2020
1 parent 063aa6f commit 1b610c8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node
'use strict'

const emailRegex = require('email-regex')()
const emailRegex = require('email-regex')
const existsFile = require('exists-file')
const jsonFuture = require('json-future')
const execa = require('execa')
Expand Down Expand Up @@ -133,7 +133,7 @@ const getContributors = async () => {
? !new RegExp(pkgAuthor, 'i').test(email)
: !isSameEmail(pkgAuthor.email, email)
)
.filter(({ email }) => emailRegex.test(email))
.filter(({ email }) => emailRegex().test(email))
.sort((c1, c2) => c2.commits - c1.commits)

const maxIndent = contributors.length ? getMaxIndent(contributors, 'commits') : ''
Expand Down

0 comments on commit 1b610c8

Please sign in to comment.