remove unused variables
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
define([], function () {
|
||||
var Util = {};
|
||||
|
||||
var find = Util.find = function (map, path) {
|
||||
Util.find = function (map, path) {
|
||||
return (map && path.reduce(function (p, n) {
|
||||
return typeof(p[n]) !== 'undefined' && p[n];
|
||||
}, map));
|
||||
};
|
||||
|
||||
var fixHTML = Util.fixHTML = function (str) {
|
||||
Util.fixHTML = function (str) {
|
||||
if (!str) { return ''; }
|
||||
return str.replace(/[<>&"']/g, function (x) {
|
||||
return ({ "<": "<", ">": ">", "&": "&", '"': """, "'": "'" })[x];
|
||||
});
|
||||
};
|
||||
|
||||
var hexToBase64 = Util.hexToBase64 = function (hex) {
|
||||
Util.hexToBase64 = function (hex) {
|
||||
var hexArray = hex
|
||||
.replace(/\r|\n/g, "")
|
||||
.replace(/([\da-fA-F]{2}) ?/g, "0x$1 ")
|
||||
@@ -24,7 +24,7 @@ define([], function () {
|
||||
return window.btoa(byteString).replace(/\//g, '-').slice(0,-2);
|
||||
};
|
||||
|
||||
var base64ToHex = Util.base64ToHex = function (b64String) {
|
||||
Util.base64ToHex = function (b64String) {
|
||||
var hexArray = [];
|
||||
atob(b64String.replace(/-/g, '/')).split("").forEach(function(e){
|
||||
var h = e.charCodeAt(0).toString(16);
|
||||
@@ -34,9 +34,9 @@ define([], function () {
|
||||
return hexArray.join("");
|
||||
};
|
||||
|
||||
var uint8ArrayToHex = Util.uint8ArrayToHex = function (a) {
|
||||
Util.uint8ArrayToHex = function (a) {
|
||||
// call slice so Uint8Arrays work as expected
|
||||
return Array.prototype.slice.call(a).map(function (e, i) {
|
||||
return Array.prototype.slice.call(a).map(function (e) {
|
||||
var n = Number(e & 0xff).toString(16);
|
||||
if (n === 'NaN') {
|
||||
throw new Error('invalid input resulted in NaN');
|
||||
@@ -51,7 +51,7 @@ define([], function () {
|
||||
}).join('');
|
||||
};
|
||||
|
||||
var deduplicateString = Util.deduplicateString = function (array) {
|
||||
Util.deduplicateString = function (array) {
|
||||
var a = array.slice();
|
||||
for(var i=0; i<a.length; i++) {
|
||||
for(var j=i+1; j<a.length; j++) {
|
||||
@@ -61,11 +61,11 @@ define([], function () {
|
||||
return a;
|
||||
};
|
||||
|
||||
var getHash = Util.getHash = function () {
|
||||
Util.getHash = function () {
|
||||
return window.location.hash.slice(1);
|
||||
};
|
||||
|
||||
var replaceHash = Util.replaceHash = function (hash) {
|
||||
Util.replaceHash = function (hash) {
|
||||
if (window.history && window.history.replaceState) {
|
||||
if (!/^#/.test(hash)) { hash = '#' + hash; }
|
||||
return void window.history.replaceState({}, window.document.title, hash);
|
||||
@@ -76,16 +76,16 @@ define([], function () {
|
||||
/*
|
||||
* Saving files
|
||||
*/
|
||||
var fixFileName = Util.fixFileName = function (filename) {
|
||||
Util.fixFileName = function (filename) {
|
||||
return filename.replace(/ /g, '-').replace(/[\/\?]/g, '_')
|
||||
.replace(/_+/g, '_');
|
||||
};
|
||||
|
||||
var bytesToMegabytes = Util.bytesToMegabytes = function (bytes) {
|
||||
Util.bytesToMegabytes = function (bytes) {
|
||||
return Math.floor((bytes / (1024 * 1024) * 100)) / 100;
|
||||
};
|
||||
|
||||
var bytesToKilobytes = Util.bytesToKilobytes = function (bytes) {
|
||||
Util.bytesToKilobytes = function (bytes) {
|
||||
return Math.floor(bytes / 1024 * 100) / 100;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user