Comparing version 0.3.2 to 0.3.3
{ | ||
"name": "sweatmap", | ||
"description": "SweatMap takes in a series of UTF-8 strings and maps them to UTF-8 strings that are as small as possible while still being unique.", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Benjamin Solum", |
@@ -0,0 +0,0 @@ # SweatMap |
108
test/test.js
@@ -6,5 +6,5 @@ "use strict"; | ||
describe("SweatMap", function() { | ||
describe("#constructor(existing_strings, additional_ranges)", function() { | ||
it("Default character limits:", function() { | ||
describe("SweatMap", function () { | ||
describe("#constructor(existing_strings, additional_ranges)", function () { | ||
it("Default character limits:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -17,3 +17,3 @@ | ||
it("Can pass in existing UTF-8 String key/values:", function() { | ||
it("Can pass in existing UTF-8 String key/values:", function () { | ||
var myMap = new SweatMap({ | ||
@@ -23,4 +23,4 @@ existing_strings: { | ||
"☃": "�", | ||
Ignored: {} | ||
} | ||
Ignored: {}, | ||
}, | ||
}); | ||
@@ -36,3 +36,3 @@ | ||
it("Can pass in adjusted character ranges:", function() { | ||
it("Can pass in adjusted character ranges:", function () { | ||
var myMap = new SweatMap({ | ||
@@ -43,4 +43,4 @@ additional_ranges: { | ||
"a-z": { start: "61", end: "7A" }, //Add a-z | ||
"Basic Latin": { end: null } //Removes Basic Latin | ||
} | ||
"Basic Latin": { end: null }, //Removes Basic Latin | ||
}, | ||
}); | ||
@@ -53,3 +53,3 @@ | ||
it("Character ranges are frozen:", function() { | ||
it("Character ranges are frozen:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -63,3 +63,3 @@ | ||
it("No default entries:", function() { | ||
it("No default entries:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -69,11 +69,11 @@ | ||
value: undefined, | ||
done: true | ||
done: true, | ||
}); | ||
assert.deepEqual(myMap.rmap.entries().next(), { | ||
value: undefined, | ||
done: true | ||
done: true, | ||
}); | ||
}); | ||
it("Can set CSS Safe Mode:", function() { | ||
it("Can set CSS Safe Mode:", function () { | ||
var myMap = new SweatMap({ cssSafe: true }); | ||
@@ -85,4 +85,4 @@ | ||
describe("bytes(str)", function() { | ||
it("Returns bytes for a given string:", function() { | ||
describe("bytes(str)", function () { | ||
it("Returns bytes for a given string:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -99,4 +99,4 @@ | ||
describe("size(str)", function() { | ||
it("Returns size of map:", function() { | ||
describe("size(str)", function () { | ||
it("Returns size of map:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -114,4 +114,4 @@ | ||
describe("cssSafeString(str)", function() { | ||
it("Determines if a string is a valid css identifier (e.g. class/id):", function() { | ||
describe("cssSafeString(str)", function () { | ||
it("Determines if a string is a valid css identifier (e.g. class/id):", function () { | ||
var myMap = new SweatMap(); | ||
@@ -131,5 +131,5 @@ | ||
describe("generatePatternForBytes(bytes)", function() { | ||
describe("generatePatternForBytes(bytes)", function () { | ||
var myMap; | ||
var patternCountTest = function(bytes) { | ||
var patternCountTest = function (bytes) { | ||
var expectedPatterns = Math.pow(2, bytes - 1); | ||
@@ -152,3 +152,3 @@ var patterns = myMap.generatePatternForBytes(bytes); | ||
beforeEach(function() { | ||
beforeEach(function () { | ||
myMap = new SweatMap({ | ||
@@ -158,24 +158,24 @@ additional_ranges: { | ||
"a-z": { start: "61", end: "7A" }, //Add a-z | ||
"Basic Latin": { end: null } //Removes Basic Latin | ||
} | ||
"Basic Latin": { end: null }, //Removes Basic Latin | ||
}, | ||
}); | ||
}); | ||
it("Should generate proper number of patterns for 1 bytes", function() { | ||
it("Should generate proper number of patterns for 1 bytes", function () { | ||
patternCountTest(1); | ||
}); | ||
it("Should generate proper number of patterns for 2 bytes", function() { | ||
it("Should generate proper number of patterns for 2 bytes", function () { | ||
patternCountTest(2); | ||
}); | ||
it("Should generate proper number of patterns for 3 bytes", function() { | ||
it("Should generate proper number of patterns for 3 bytes", function () { | ||
patternCountTest(3); | ||
}); | ||
it("Should generate proper number of patterns for 4 bytes", function() { | ||
it("Should generate proper number of patterns for 4 bytes", function () { | ||
patternCountTest(4); | ||
}); | ||
it("Should generate proper number of patterns for 5 bytes", function() { | ||
it("Should generate proper number of patterns for 5 bytes", function () { | ||
patternCountTest(5); | ||
@@ -185,6 +185,6 @@ }); | ||
describe("set(key)", function() { | ||
describe("set(key)", function () { | ||
var myMap; | ||
beforeEach(function() { | ||
beforeEach(function () { | ||
myMap = new SweatMap({ | ||
@@ -194,8 +194,8 @@ additional_ranges: { | ||
"a-z": { start: "61", end: "7A" }, //Add a-z | ||
"Basic Latin": { end: null } //Removes Basic Latin | ||
} | ||
"Basic Latin": { end: null }, //Removes Basic Latin | ||
}, | ||
}); | ||
}); | ||
it("Returns the same obfuscated value given the same key:", function() { | ||
it("Returns the same obfuscated value given the same key:", function () { | ||
var str1 = myMap.set("string"); | ||
@@ -207,3 +207,3 @@ var str2 = myMap.set("string"); | ||
it("Returns an error if the key is not a string:", function() { | ||
it("Returns an error if the key is not a string:", function () { | ||
assert.throws( | ||
@@ -232,3 +232,3 @@ () => { | ||
() => { | ||
myMap.set(function() {}); | ||
myMap.set(function () {}); | ||
}, | ||
@@ -254,3 +254,3 @@ Error, | ||
it("Returns an error if the key is an empty string:", function() { | ||
it("Returns an error if the key is an empty string:", function () { | ||
assert.throws( | ||
@@ -265,3 +265,3 @@ () => { | ||
it("Obfuscates the given keys correctly:", function() { | ||
it("Obfuscates the given keys correctly:", function () { | ||
//LONG Timeout -> 1min | ||
@@ -292,3 +292,3 @@ this.timeout(60000); | ||
it("Obfuscates the given keys correctly (CSS Safe):", function() { | ||
it("Obfuscates the given keys correctly (CSS Safe):", function () { | ||
//LONG Timeout -> 1min | ||
@@ -322,4 +322,4 @@ this.timeout(60000); | ||
describe("delete(key)", function() { | ||
it("Deletes values from both fmap and rmap for a given key:", function() { | ||
describe("delete(key)", function () { | ||
it("Deletes values from both fmap and rmap for a given key:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -349,4 +349,4 @@ | ||
describe("clear()", function() { | ||
it("Clears values from both fmap and rmap:", function() { | ||
describe("clear()", function () { | ||
it("Clears values from both fmap and rmap:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -370,4 +370,4 @@ | ||
describe("entries()", function() { | ||
it("Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order:", function() { | ||
describe("entries()", function () { | ||
it("Returns a new Iterator object that contains an array of [key, value] for each element in the Map object in insertion order:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -382,4 +382,4 @@ | ||
describe("get(key)", function() { | ||
it("Get values from the map:", function() { | ||
describe("get(key)", function () { | ||
it("Get values from the map:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -394,4 +394,4 @@ | ||
describe("get_obfuscated(value)", function() { | ||
it("Get keys from the map:", function() { | ||
describe("get_obfuscated(value)", function () { | ||
it("Get keys from the map:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -406,4 +406,4 @@ | ||
describe("has(key)", function() { | ||
it("Can see if it has a key in the map:", function() { | ||
describe("has(key)", function () { | ||
it("Can see if it has a key in the map:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -419,4 +419,4 @@ | ||
describe("has_obfuscated(value)", function() { | ||
it("Can see if it has a value in the map:", function() { | ||
describe("has_obfuscated(value)", function () { | ||
it("Can see if it has a value in the map:", function () { | ||
var myMap = new SweatMap(); | ||
@@ -423,0 +423,0 @@ |
@@ -10,7 +10,7 @@ var path = require("path"); | ||
entry: { | ||
sweatmap: path.resolve(__dirname, "node", "sweatmap.js") | ||
sweatmap: path.resolve(__dirname, "node", "sweatmap.js"), | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, "browser"), | ||
filename: "[name]-" + packageJSON.version + ".min.js" | ||
filename: "[name]-" + packageJSON.version + ".min.js", | ||
}, | ||
@@ -21,5 +21,5 @@ module: { | ||
include: path.resolve(__dirname, "node", "sweatmap.js"), | ||
loader: "babel-loader" | ||
} | ||
] | ||
loader: "babel-loader", | ||
}, | ||
], | ||
}, | ||
@@ -33,14 +33,14 @@ optimization: { | ||
drop_console: true, | ||
drop_debugger: true | ||
drop_debugger: true, | ||
}, | ||
output: { | ||
comments: false | ||
comments: false, | ||
}, | ||
mangle: true, | ||
ie8: false | ||
} | ||
}) | ||
] | ||
ie8: false, | ||
}, | ||
}), | ||
], | ||
}, | ||
node: { fs: "empty" } | ||
node: { fs: "empty" }, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
156075
12