Skip to content

Commit

Permalink
fix import error due to is-email
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoollllee committed Sep 12, 2024
1 parent 6aa5745 commit fbb0824
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Install the module to your Nuxt application with one command:

```bash
npx nuxi module add nuxt-protected-mailto
# or with npm and manually adding the module to your nuxt.config.ts
npm install nuxt-protected-mailto
```

Use the global `Mailto` [Component](./src/runtime/components/Mailto.vue):
Expand Down
13 changes: 3 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
"lint": "eslint ."
},
"dependencies": {
"@nuxt/kit": "^3.13.1",
"is-email": "latest"
"@nuxt/kit": "^3.13.1"
},
"devDependencies": {
"@nuxt/devtools": "^1.4.2",
Expand Down
13 changes: 12 additions & 1 deletion src/runtime/components/Mailto.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,18 @@
</template>

<script>
import isEmail from 'is-email'
/**
* validate an email address.
*
* @param {string} string
* @return {boolean}
*/
function isEmail(string) {
// Email address matcher.
const matcher = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/
if (string.length > 320) return false
return matcher.test(string)
}
function formatMail(mail, asArray = false, pretty = true) {
if (typeof mail === 'string') {
Expand Down

0 comments on commit fbb0824

Please sign in to comment.