{"id":15939648,"url":"https://github.com/binarykitchen/munge","last_synced_at":"2025-09-02T15:46:02.598Z","repository":{"id":6690643,"uuid":"7935786","full_name":"binarykitchen/munge","owner":"binarykitchen","description":"a tiny node module to munge any strings. useful if wou want to obfuscate email addresses to valid, numeric html entities","archived":false,"fork":false,"pushed_at":"2023-03-04T04:31:05.000Z","size":1531,"stargazers_count":3,"open_issues_count":6,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-29T14:12:44.531Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://npmjs.org/package/munge","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/binarykitchen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-01-31T11:45:22.000Z","updated_at":"2024-02-11T18:59:02.000Z","dependencies_parsed_at":"2024-10-07T06:20:38.577Z","dependency_job_id":"00e9b9d9-065b-44ac-9354-e65fa5c499e0","html_url":"https://github.com/binarykitchen/munge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fmunge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fmunge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fmunge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/binarykitchen%2Fmunge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/binarykitchen","download_url":"https://codeload.github.com/binarykitchen/munge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232802573,"owners_count":18578685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-07T06:20:30.052Z","updated_at":"2025-01-07T00:18:28.066Z","avatar_url":"https://github.com/binarykitchen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# munge\n\n[![Build Status](https://travis-ci.org/binarykitchen/munge.png?branch=master)](https://travis-ci.org/binarykitchen/munge)\n\na tiny library to munge any strings (do not ask me why that verb). useful if wou want to obfuscate email addresses to valid, numeric html characters.\n\nas 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.\n\n## basic example\n\nby default, munge() encodes each letter by random - either ascii or unicode - to make it more difficult for spammers.\n\nbecause of the random generator the example below does not always produce the same output:\n\n\n``` js\nvar munge = require('munge');\nconsole.log(munge('spacemonkey@moon.com'));\n```\n\nmight output something like:\n```\n\u0026#x0073;\u0026#x0070;\u0026#x0061;\u0026#99;\u0026#x0065;\u0026#x006D;\u0026#x006F;\u0026#x006E;\u0026#107;\u0026#x0065;\u0026#x0079;\u0026#x0040;\u0026#x006D;\u0026#111;\u0026#x006F;\u0026#110;\u0026#46;\u0026#99;\u0026#x006F;\u0026#x006D;\n```\n\nthis is valid html code!\n\nbased on rfc1866, ftp://ftp.rfc-editor.org/in-notes/rfc1866.txt\n\n## more examples\n\n### ascii\n\n``` js\nvar munge = require('munge');\nconsole.log(munge('spacemonkey@moon.com', {encoding: 'ascii'}));\n```\n\nshould encode the string with ascii like that:\n```\n\u0026#115;\u0026#112;\u0026#97;\u0026#99;\u0026#101;\u0026#109;\u0026#111;\u0026#110;\u0026#107;\u0026#101;\u0026#121;\u0026#64;\u0026#109;\u0026#111;\u0026#111;\u0026#110;\u0026#46;\u0026#99;\u0026#111;\u0026#109;\n```\n\n### utf8\n\n``` js\nvar munge = require('munge');\nconsole.log(munge('spacemonkey@moon.com', {encoding: 'utf8'}));\n```\n\nencodes the same blurb but in unicode:\n```\n\u0026#x0073;\u0026#x0070;\u0026#x0061;\u0026#x0063;\u0026#x0065;\u0026#x006D;\u0026#x006F;\u0026#x006E;\u0026#x006B;\u0026#x0065;\u0026#x0079;\u0026#x0040;\u0026#x006D;\u0026#x006F;\u0026#x006F;\u0026#x006E;\u0026#x002E;\u0026#x0063;\u0026#x006F;\u0026#x006D;\n```\n\n### jade/express integration\n\ngood idea. you will want to protect your email address on your contact page.\n\nhere 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:\n\n``` js\nvar munge = require('munge');\n\nexports.contact = function(req, res) {\n  res.render('contact',\n    {\n      emailContact: munge('spacemonkey@moon.com')\n    }\n  );\n};\n```\n\nthen you can show the munged email address in a jade template called contact.jade with the lines like this inbetween:\n\n``` js\n...\np email:\u0026nbsp;\n    a(href!=\"mailto:#{emailContact}\") !{emailContact}\n...\n```\n\nmake sure you use ! exactly like this as this won't escape the ampersand (\u0026) into an html entity. see TJ's remark about escaped stuff at https://github.com/visionmedia/jade#code\n\n\n## todo\n\n* implement a connect middleware to automagically munge any email addresses\n* have it a piped stream instead (for larger strings; not sure if it makes sense here)\n\n## license\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarykitchen%2Fmunge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbinarykitchen%2Fmunge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbinarykitchen%2Fmunge/lists"}