Socket
Socket
Sign inDemoInstall

munge

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

munge - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

2

package.json
{
"name": "munge",
"version": "0.0.3",
"version": "0.1.0",
"description": "a tiny node module to munge any strings. useful if wou want to obfuscate email addresses to valid, numeric html entities.",

@@ -5,0 +5,0 @@ "main": "munge.js",

# munge
ummm, just a tiny node module to munge any strings. useful if wou want to obfuscate email addresses to valid, numeric html entities.
ummm, just a tiny node module to munge any strings. useful if wou want to obfuscate email addresses to valid, numeric html characters.
as long as spam robots are still dumb, this should significantly reduce the risk of the email address being harvested.
as long as spam robots are still dumb, this should significantly reduce the risk of the email address being harvested. i bet you get 60% less spam. this method is user friendlier and way easier to implement than other tricks like javascript or images. because you really can click on the link and it opens in your mail program.
## simple example
by default, munge() encodes each char with a random encoding, either ascii or unicode, to make it more difficult for spammers.
by default, munge() encodes each letter by random - either ascii or unicode - to make it more difficult for spammers.

@@ -57,5 +57,35 @@ because of the random generator the example below does not always produce the same output:

## jade integration
good idea. you will want to protect your email address on your contact page.
here how you can do it within express and jade. let's say in express you have a route for a contact page (routes/contact.js) like this:
``` js
var munge = require('munge');
exports.contact = function(req, res) {
res.render('contact',
{
emailContact: munge('spacemonkey@moon.com')
}
);
};
```
then you can show the munged email address in a jade template called contact.jade with the lines like this inbetween:
``` js
...
p email: 
a(href!="mailto:#{emailContact}") !{emailContact}
...
```
make sure you use ! exactly like this as this won't escape the ampersand (&) into an html entity. see TJ's remark about escaped stuff at https://github.com/visionmedia/jade#code
## todo
* express/jade integration
* implement a connect middleware to automagically munge any email addresses
* have it a piped stream instead (for larger strings; not sure if it makes sense here)

@@ -62,0 +92,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc