email-scramble
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "email-scramble", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Scrambles email addresses to hide them from bots.", | ||
"main": "email-scramble.js", | ||
"scripts": { | ||
"test": "mocha test/*.js", | ||
"lint": "jshint email-scramble.js test/*.js" | ||
"test": "istanbul cover _mocha -- -R spec", | ||
"lint": "jshint email-scramble.js test/*.js", | ||
"codeclimate": "CODECLIMATE_REPO_TOKEN=dcfbb93321d8ba7c68bc53c7e230a48e1d6aa6d3891f6a06c5d034b0261c2dfb codeclimate < coverage/lcov.info" | ||
}, | ||
@@ -36,4 +37,7 @@ "repository": { | ||
"chai": "^1.10.0", | ||
"codeclimate-test-reporter": "0.0.4", | ||
"istanbul": "^0.3.5", | ||
"jshint": "^2.5.11", | ||
"mocha": "^2.1.0" | ||
} | ||
} |
email-scramble | ||
============== | ||
[![npm](https://img.shields.io/npm/v/email-scramble.svg?style=flat-square)](https://www.npmjs.com/package/email-scramble) [![Dependency Status](https://img.shields.io/david/ThibWeb/email-scramble.svg?style=flat-square)](https://david-dm.org/ThibWeb/email-scramble) [![devDependency Status](https://img.shields.io/david/dev/ThibWeb/email-scramble.svg?style=flat-square)](https://david-dm.org/ThibWeb/email-scramble#info=devDependencies) [![Code Climate](https://img.shields.io/codeclimate/github/ThibWeb/email-scramble.svg?style=flat-square)](https://codeclimate.com/github/ThibWeb/email-scramble) | ||
[![npm](https://img.shields.io/npm/v/email-scramble.svg?style=flat-square)](https://www.npmjs.com/package/email-scramble) [![Bower](https://img.shields.io/bower/v/email-scramble.svg?style=flat-square)](http://bower.io/search/?q=email-scramble) [![Build Status](https://img.shields.io/travis/ThibWeb/email-scramble.svg?style=flat-square)](https://travis-ci.org/ThibWeb/email-scramble) [![devDependency Status](https://img.shields.io/david/dev/ThibWeb/email-scramble.svg?style=flat-square)](https://david-dm.org/ThibWeb/email-scramble#info=devDependencies) [![Code Climate](https://img.shields.io/codeclimate/github/ThibWeb/email-scramble.svg?style=flat-square)](https://codeclimate.com/github/ThibWeb/email-scramble) [![Test Coverage](https://img.shields.io/codeclimate/coverage/github/ThibWeb/email-scramble.svg?style=flat-square)](https://codeclimate.com/github/ThibWeb/email-scramble) | ||
Scrambles email addresses to hide them from bots. | ||
Scrambles email addresses to hide them from bots. This library can be used server-side with Node/io.js or on the front-end. | ||
[![NPM](https://nodei.co/npm/email-scramble.png?downloads=true&stars=true)](https://www.npmjs.com/package/email-scramble) | ||
Have a look at [the examples](https://rawgit.com/ThibWeb/email-scramble/master/examples/index.html). | ||
If you'd like to know more about email obfuscation techniques and their success ratio, [here's a great blog post on the subject](http://techblog.tilllate.com/2008/07/20/ten-methods-to-obfuscate-e-mail-addresses-compared/). | ||
## Getting Started | ||
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). | ||
~~~javascript | ||
// 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: | ||
~~~javascript | ||
(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); | ||
~~~ | ||
### Download & import | ||
email-scramble is available on [npm](https://www.npmjs.com/package/email-scramble) and [bower](http://bower.io/search/?q=email-scramble), or you can [download a ZIP](https://github.com/ThibWeb/email-scramble/releases) | ||
~~~ | ||
$ 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: | ||
~~~javascript | ||
// 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 | ||
@@ -18,3 +70,2 @@ | ||
$ npm run lint | ||
$ npm start | ||
~~~ | ||
@@ -27,6 +78,2 @@ | ||
## TODO | ||
- More tests | ||
## LICENSE (ISC) | ||
@@ -33,0 +80,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
74422
10
140
92
5