email-scramble
Advanced tools
Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "email-scramble", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Scrambles email addresses and phone numbers with ROT-18 to hide them from bots", | ||
"main": "email-scramble.js", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "istanbul cover _mocha -- -R spec", | ||
"lint": "jshint email-scramble.js test/*.js", | ||
"linter:js": "jshint", | ||
"lint:js": "npm run linter:js -s -- index.js test/*.js", | ||
"lint": "npm run lint:js -s", | ||
"codeclimate": "CODECLIMATE_REPO_TOKEN=dcfbb93321d8ba7c68bc53c7e230a48e1d6aa6d3891f6a06c5d034b0261c2dfb codeclimate < coverage/lcov.info" | ||
@@ -40,8 +42,8 @@ }, | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"codeclimate-test-reporter": "0.0.4", | ||
"istanbul": "^0.3.5", | ||
"chai": "^3.2.0", | ||
"codeclimate-test-reporter": "^0.3.1", | ||
"istanbul": "^0.4.3", | ||
"jshint": "^2.5.11", | ||
"mocha": "^2.1.0" | ||
"mocha": "^3.0.0" | ||
} | ||
} |
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) | ||
> Universal JavaScript helper to encode/decode email addresses and phone numbers with ROT-18 to hide them from bots. This library can be used server-side with Node or on the front-end (CommonJS, AMD, global variable). | ||
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). | ||
[![npm](https://img.shields.io/npm/v/email-scramble.svg?style=flat-square)](https://www.npmjs.com/package/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) | ||
@@ -15,52 +15,59 @@ > Have a look at [the examples](https://rawgit.com/ThibWeb/email-scramble/master/examples/index.html). | ||
~~~javascript | ||
var encodedEmail = emailScramble.encode('mail@example.com'); | ||
var decodedMail = emailScramble.decode(encodedMail); | ||
```js | ||
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); | ||
} | ||
~~~ | ||
// 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(13, 0, str); | ||
} | ||
// Functional-programming partial application style: | ||
var myRot = emailScramble.rot.bind(emailScramble, 13, 0); | ||
``` | ||
Here's a real-world example: | ||
~~~javascript | ||
// <a id="scrambled" href="znvygb:znvy@rknzcyr.pbz">Send me an email!</a> | ||
var link = document.getElementById('scrambled'); | ||
```js | ||
// <a href="znvygb:znvy@rknzcyr.pbz" data-email-scramble>Send me an email!</a> | ||
var links = document.querySelectorAll('[data-email-scramble]'); | ||
links.forEach(function decodeLink(link) { | ||
link.href = emailScramble.decode(link.href); | ||
~~~ | ||
}); | ||
``` | ||
### 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) | ||
`email-scramble` is available on [npm](https://www.npmjs.com/package/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 | ||
~~~ | ||
``` | ||
npm 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: | ||
This library can be used as an ES6 module, Node/Browserify CommonJS-like module, a RequireJS AMD module or a global: | ||
~~~javascript | ||
// The CommonJS way. | ||
var emailScramble = require('email-scramble'); | ||
```js | ||
// ES6 | ||
import emailScramble from 'email-scramble'; | ||
// Require email-scramble when defining an AMD module. | ||
define('mypackage', ['email-scramble'], function (emailScramble) { | ||
// [...] | ||
}); | ||
// The CommonJS way. | ||
var emailScramble = require('email-scramble'); | ||
// Global variable. | ||
var emailScramble = window.emailScramble; | ||
~~~ | ||
// Global variable. | ||
var emailScramble = window.emailScramble; | ||
``` | ||
## Contributing | ||
~~~ | ||
$ npm install | ||
$ npm test | ||
$ npm run lint | ||
~~~ | ||
```bash | ||
# Install deps | ||
npm install | ||
# Test | ||
npm test | ||
npm run lint | ||
# Install git hooks | ||
./.githooks/deploy | ||
``` | ||
@@ -74,3 +81,3 @@ ## Built with | ||
Copyright (c) 2015, Thibaud Colas | ||
Copyright (c) 2016, Thibaud Colas | ||
@@ -77,0 +84,0 @@ Permission to use, copy, modify, and/or distribute this software for any |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
93
8430
5
61
2