munge
Advanced tools
Comparing version 0.1.8 to 0.2.0
{ | ||
"name": "munge", | ||
"version": "0.1.8", | ||
"description": "a tiny node module to munge any strings. useful if you want to obfuscate email addresses to valid, numeric html entities.", | ||
"main": "munge.js", | ||
"author": "Michael Heuberger <michael.heuberger@binarykitchen.com>", | ||
"keywords": ["munge", "email", "spam", "obfuscation", "ascii", "utf8"], | ||
"devDependencies": { | ||
"nodeunit": "0.11.0" | ||
}, | ||
"engines": { | ||
"node": ">=4.2.0" | ||
}, | ||
"scripts": { | ||
"test": "nodeunit tests/basics.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/binarykitchen/munge.git" | ||
}, | ||
"license": "MIT" | ||
"name": "munge", | ||
"version": "0.2.0", | ||
"description": "a tiny node module to munge any strings. useful if you want to obfuscate email addresses to valid, numeric html entities.", | ||
"author": { | ||
"name": "Michael Heuberger", | ||
"email": "michael.heuberger@binarykitchen.com", | ||
"url": "https://binarykitchen.com" | ||
}, | ||
"source": "index.js", | ||
"main": "dist/munge.js", | ||
"module": "dist/munge.mjs", | ||
"unpkg": "dist/munge.umd.js", | ||
"scripts": { | ||
"test": "nodeunit tests/basics.js", | ||
"lint": "standard index.js", | ||
"build": "microbundle" | ||
}, | ||
"devDependencies": { | ||
"microbundle": "0.11.0", | ||
"nodeunit": "0.11.3", | ||
"standard": "13.1.0" | ||
}, | ||
"engines": { | ||
"node": ">=8.10.0", | ||
"yarn": ">=1.3.0", | ||
"npm": ">=5.4.0" | ||
}, | ||
"keywords": [ | ||
"munge", | ||
"email", | ||
"spam", | ||
"obfuscation", | ||
"ascii", | ||
"utf8" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:binarykitchen/munge.git" | ||
}, | ||
"license": "MIT" | ||
} |
@@ -1,94 +0,89 @@ | ||
"use strict"; | ||
const testCase = require('nodeunit').testCase | ||
var testCase = require('nodeunit').testCase, | ||
munge; | ||
var munge | ||
// boo, type checks are not enabled in nodeunit | ||
function isFunction(anything) | ||
{ | ||
return typeof(anything) == 'function'; | ||
function isFunction (anything) { | ||
return typeof (anything) === 'function' | ||
} | ||
// boo, type checks are not enabled in nodeunit | ||
function isString(anything) | ||
{ | ||
return typeof(anything) == 'string'; | ||
function isString (anything) { | ||
return typeof (anything) === 'string' | ||
} | ||
module.exports = testCase({ | ||
'loading munge (require)': function(t) { | ||
munge = require('../munge.js'); | ||
'loading munge (require)': function (t) { | ||
munge = require('../index.js') | ||
t.ok(munge, 'munge module is loaded.'); | ||
t.done() | ||
}, | ||
t.ok(munge, 'munge module is loaded.') | ||
t.done() | ||
}, | ||
'checking type munge.email': function(t) { | ||
t.ok(isFunction(munge), 'type of munge.email is a function.'); | ||
t.done(); | ||
}, | ||
'checking type munge.email': function (t) { | ||
t.ok(isFunction(munge), 'type of munge.email is a function.') | ||
t.done() | ||
}, | ||
'munge with weird parameters': function(t) { | ||
var nothingMunged = munge(); | ||
t.strictEqual(nothingMunged, '', 'empty parameter returns an empty string'); | ||
'munge with weird parameters': function (t) { | ||
const nothingMunged = munge() | ||
t.strictEqual(nothingMunged, '', 'empty parameter returns an empty string') | ||
t.throws(function() { | ||
munge({}); | ||
}, 'TypeError', 'first parameter as an object causes TypeError to be thrown.'); | ||
t.throws(function () { | ||
munge({}) | ||
}, 'TypeError', 'first parameter as an object causes TypeError to be thrown.') | ||
t.throws(function() { | ||
munge(null, {encoding: 'hex'}); | ||
}, 'Error', 'unsupported encoding parameter causes an error to be thrown.'); | ||
t.throws(function () { | ||
munge(null, { encoding: 'hex' }) | ||
}, 'Error', 'unsupported encoding parameter causes an error to be thrown.') | ||
t.doesNotThrow(function() { | ||
munge(null, {encoding: 'ascii'}); | ||
}, 'Error', 'encoding option ascii should not throw an error.'); | ||
t.doesNotThrow(function () { | ||
munge(null, { encoding: 'ascii' }) | ||
}, 'Error', 'encoding option ascii should not throw an error.') | ||
t.doesNotThrow(function() { | ||
munge(null, {encoding: 'utf8'}); | ||
}, 'Error', 'encoding option utf8 should not throw an error.'); | ||
t.doesNotThrow(function () { | ||
munge(null, { encoding: 'utf8' }) | ||
}, 'Error', 'encoding option utf8 should not throw an error.') | ||
t.doesNotThrow(function() { | ||
munge(null, {encoding: 'random'}); | ||
}, 'Error', 'encoding option random should not throw an error.'); | ||
t.doesNotThrow(function () { | ||
munge(null, { encoding: 'random' }) | ||
}, 'Error', 'encoding option random should not throw an error.') | ||
t.done(); | ||
}, | ||
t.done() | ||
}, | ||
'munge my own email address by random': function(t) { | ||
var EMAIL_ADDRESS = 'spacemonkey@moon.com'; | ||
'munge my own email address by random': function (t) { | ||
const EMAIL_ADDRESS = 'spacemonkey@moon.com' | ||
var mungedEmailAddress = munge(EMAIL_ADDRESS); | ||
const mungedEmailAddress = munge(EMAIL_ADDRESS) | ||
t.ok(mungedEmailAddress, 'munged email address is not empty.'); | ||
t.ok(isString(mungedEmailAddress), 'munged email address is a string.'); | ||
t.ok(mungedEmailAddress, 'munged email address is not empty.') | ||
t.ok(isString(mungedEmailAddress), 'munged email address is a string.') | ||
t.done(); | ||
}, | ||
t.done() | ||
}, | ||
'ASCII munge my own email address': function(t) { | ||
var EMAIL_ADDRESS = 'spacemonkey@moon.com', | ||
MUNGED_EMAIL_ADDRESS = 'spacemonkey@moon.com'; | ||
'ASCII munge my own email address': function (t) { | ||
const EMAIL_ADDRESS = 'spacemonkey@moon.com' | ||
const MUNGED_EMAIL_ADDRESS = 'spacemonkey@moon.com' | ||
var mungedEmailAddress = munge(EMAIL_ADDRESS, {encoding: 'ascii'}); | ||
const mungedEmailAddress = munge(EMAIL_ADDRESS, { encoding: 'ascii' }) | ||
t.ok(mungedEmailAddress, 'ascii mungedd email address is not empty.'); | ||
t.ok(isString(mungedEmailAddress), 'ascii munged email address is a string.'); | ||
t.strictEqual(mungedEmailAddress, MUNGED_EMAIL_ADDRESS, 'ascii munged email address is correct.'); | ||
t.ok(mungedEmailAddress, 'ascii mungedd email address is not empty.') | ||
t.ok(isString(mungedEmailAddress), 'ascii munged email address is a string.') | ||
t.strictEqual(mungedEmailAddress, MUNGED_EMAIL_ADDRESS, 'ascii munged email address is correct.') | ||
t.done(); | ||
}, | ||
t.done() | ||
}, | ||
'UTF8 munge my own email address': function(t) { | ||
var EMAIL_ADDRESS = 'spacemonkey@moon.com', | ||
MUNGED_EMAIL_ADDRESS = 'spacemonkey@moon.com'; | ||
'UTF8 munge my own email address': function (t) { | ||
const EMAIL_ADDRESS = 'spacemonkey@moon.com' | ||
const MUNGED_EMAIL_ADDRESS = 'spacemonkey@moon.com' | ||
var mungedEmailAddress = munge(EMAIL_ADDRESS, {encoding: 'utf8'}); | ||
const mungedEmailAddress = munge(EMAIL_ADDRESS, { encoding: 'utf8' }) | ||
t.ok(mungedEmailAddress, 'utf8 munged email address is not empty.'); | ||
t.ok(isString(mungedEmailAddress), 'utf8 munged email address is a string.'); | ||
t.strictEqual(mungedEmailAddress, MUNGED_EMAIL_ADDRESS, 'utf8 munged email address is correct.'); | ||
t.ok(mungedEmailAddress, 'utf8 munged email address is not empty.') | ||
t.ok(isString(mungedEmailAddress), 'utf8 munged email address is a string.') | ||
t.strictEqual(mungedEmailAddress, MUNGED_EMAIL_ADDRESS, 'utf8 munged email address is correct.') | ||
t.done(); | ||
} | ||
}); | ||
t.done() | ||
} | ||
}) |
Sorry, the diff of this file is not supported yet
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
18930
12
128
3
1