Created
April 26, 2018 09:33
-
-
Save ratelChief/96d14bbda707e15ea1ba254313fcc990 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.util = (function () { | |
var ESC_KEYCODE = 27; | |
var ENTER_KEYCODE = 13; | |
return { | |
isEscEvent: function (evt, action) { | |
if (evt.keyCode === ESC_KEYCODE) { | |
action(); | |
} | |
}, | |
isEnterEvent: function (evt, action) { | |
if (evt.keyCode === ENTER_KEYCODE) { | |
action(); | |
} | |
}, | |
getRandomValue: function (arr) { | |
var result = arr[Math.floor(Math.random() * (arr.length))]; | |
return result; | |
}, | |
getWizardName: function (wizardNames, wizardLastnames) { | |
var name = getRandomValue(wizardNames) + ' ' + getRandomValue(wizardLastnames); | |
return name; | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment