
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
email-scramble
Advanced tools
Scrambles email addresses to hide them from bots. This library can be used server-side with Node/io.js or on the front-end.
Have a look at the examples.
If you'd like to know more about email obfuscation techniques and their success ratio, here's a great blog post on the subject.
email-scramble uses a simple ROT transformation. The rotation amount can be any integer between 1 and 25. 0 and 26 won't produce any transformation, other numbers are useless (e.g. ROT-42 = ROT-16).
// To encode, first pick the ROT amount you want.
var encode = emailScramble.encoder(16);
var encodedEmail = encode('mail@example.com');
// To decode, you should pick the same ROT amount.
var decode = emailScramble.decoder(16);
var decodedMail = decode(encodedMail);
Here's a real-world example:
(function (emailScramble) {
'use strict';
var decode = emailScramble.decoder(5);
// <a id="scrambled" href="rfnqyt:rfnq@jcfruqj.htr">rfnq@jcfruqj.htr</a>
var link = document.getElementById('scrambled');
link.href = decode(link.href);
link.innerHTML = decode(link.innerHTML);
email-scramble is available on npm and bower, or you can download a ZIP
$ npm install --save email-scramble
$ bower install --save email-scramble
This library can be used as a Node/io.js/Browserify CommonJS-like module, a RequireJS AMD module or a global:
// The CommonJS way.
var emailScramble = require('email-scramble');
// Require email-scramble when defining an AMD module.
define('mypackage', ['email-scramble'], function (emailScramble) {
// [...]
});
// Global variable.
var emailScramble = window.emailScramble;
$ npm install
$ npm test
$ npm run lint
Copyright (c) 2015, Thibaud Colas
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
FAQs
Scrambles email addresses and phone numbers with ROT-18 to hide them from bots
The npm package email-scramble receives a total of 164 weekly downloads. As such, email-scramble popularity was classified as not popular.
We found that email-scramble demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.