obfooscator
v1.2.0
Published
A package to convert e-mail addresses to obfuscated strings containing HTML entities. Deters e-mail harvesting from page scrapers.
Downloads
2
Readme
Obfooscator
The purpose of this module is to obfuscate email addresses that you would have in HTML pages, to deter those email addresses from being harvested by page scrapers.
Installation
npm install obfooscator
Usage
Front-end:
import {obfooscator} from 'obfooscator';
let email = '[email protected]';
console.log(obfooscator(email)); //sa\u006Dpl\u0065@\u0065xa\u006Dpl\u0065.co\u006D (may vary, obfuscation is randomized)
Back-end
const obfooscator = require('obfooscator');
let email = '[email protected]';
console.log(obfooscator(email)); //sa\u006Dpl\u0065@\u0065xa\u006Dpl\u0065.co\u006D (may vary, again)
Options
You can pass an optional second param to the function in order to change from getting unicode to getting HTML entities. There is a JSX gotcha where it won't (nicely) process HTML entities without the use of hackery, so the default is the Unicode characters. However, if you are using this on the back-end, and the resulting entities don't need to get processed by JSX, then pass false
as the second param.
Example:
const obfooscator = require('obfooscator');
let email = '[email protected]';
console.log(obfooscator(email, false));
If you have any questions, please contact me at don (at) donburks (dot) com.