Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/js/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ function initDiscord() {
});
}

// Expose to the global scope
if (typeof window !== 'undefined') {
window.initDiscord = initDiscord;
}

module.exports = {
initDiscord,
randomQuote,
Expand Down
5 changes: 5 additions & 0 deletions src/js/levenshtein-distance.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,9 @@ function levenshteinDistance(a, b) {
return (1 - (matrix[b.length][a.length] / Math.max(a.length, b.length))) * 100
}

// Expose to the global scope
if (typeof window !== 'undefined') {
window.levenshteinDistance = levenshteinDistance;
}

module.exports = levenshteinDistance;
5 changes: 5 additions & 0 deletions src/js/load-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ function loadScript(url, callback) {
document.head.appendChild(script);
}

// Expose to the global scope
if (typeof window !== 'undefined') {
window.loadScript = loadScript;
}

module.exports = loadScript;
7 changes: 6 additions & 1 deletion src/js/ranking-sorter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @param secondKey The secondary key to sort by, in case the first key is equal.
* @returns {(function(*, *): (number))|*} The sorting function.
*/
let rankingSorter = function (firstKey, secondKey) {
function rankingSorter(firstKey, secondKey) {
return function(a, b) {
if (a[firstKey] > b[firstKey]) {
return -1;
Expand All @@ -23,4 +23,9 @@ let rankingSorter = function (firstKey, secondKey) {
}
}

// Expose to the global scope
if (typeof window !== 'undefined') {
window.rankingSorter = rankingSorter;
}

module.exports = rankingSorter;
5 changes: 5 additions & 0 deletions src/js/sleep.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

// Expose to the global scope
if (typeof window !== 'undefined') {
window.sleep = sleep;
}

module.exports = sleep;