@already-existed/email-obfuscator
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

EmailObfuscator

Lib for obfuscate email on server and unobfuscate on client.

Installation

npm i -S @already-existed/email-obfuscator

Usage

<!-- html -->
<a data-email="true" href="mailto:[email-href]some-email@some.com[/email-href]">
  [email]some-email@some.com[/email]
</a>
// server
import { obfuscateEmail } from '@already-existed/email-obfuscator'

...
res.send(obfuscateEmail(html))
...
// client
import { unobfuscateEmail } from '@already-existed/email-obfuscator'

window.addEventListener('load', () => {
  unobfuscateEmail()
})

Options

// 'binary' - slow
// 'base64' - fast
type ObfuscateType = 'binary' | 'base64'

interface ObfuscateOptions {
  type?: ObfuscateType // default: 'binary'
}

obfuscateEmail(value: string, opts?: ObfuscateOptions): string
unobfuscateEmail(opts?: ObfuscateOptions): void

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.1.2
    4
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.1.2
    4
  • 1.1.1
    2
  • 1.1.0
    0
  • 1.0.0
    4

Package Sidebar

Install

npm i @already-existed/email-obfuscator

Weekly Downloads

10

Version

1.1.2

License

MIT

Unpacked Size

20.9 kB

Total Files

29

Last publish

Collaborators

  • already-existed