JSPM

email-scramble

2.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 672
  • Score
    100M100P100Q78279F
  • License ISC

Scrambles email addresses and phone numbers with ROT-18 to hide them from bots

Package Exports

  • email-scramble

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (email-scramble) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

email-scramble

npm Bower Build Status devDependency Status Code Climate Test Coverage

Scrambles email addresses and phone numbers with ROT-18 to hide them from bots. This library can be used server-side with Node/io.js or on the front-end (global variable, RequireJS, Browserify).

Have a look at the examples. If you'd like to know more about obfuscation techniques and their success ratio, here's a great blog post on the subject.

Getting Started

email-scramble uses a simple ROT transformation. The default rotation is ROT-18, which means that letters will be rotated by 13 and numbers by 5.

  var encodedEmail = emailScramble.encode('mail@example.com');
  var decodedMail = emailScramble.decode(encodedMail);

  // You can also pick any other flavor of ROT:
  function myROT(str) {
    // Here letters are obfuscated with ROT-13 and numbers are kept clear.
    return emailScramble.rot(str, 13, 0);
  }

Here's a real-world example:

  // <a id="scrambled" href="znvygb:znvy@rknzcyr.pbz">Send me an email!</a>
  var link = document.getElementById('scrambled');
  link.href = emailScramble.decode(link.href);

Download & import

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;

Contributing

$ npm install
$ npm test
$ npm run lint

Built with

LICENSE (ISC)

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.