I hereby claim:
- I am ioio72 on github.
- I am tamio (https://keybase.io/tamio) on keybase.
- I have a public key ASDaC35YE-ue720vnP0n6NdQZq3vbDxlqlJTVJGtgMBDuwo
To claim this, I am signing this object:
const getKeyValueSafely = (obj, key) => ( | |
obj.hasOwnProperty(key) ? obj[key] : undefined | |
); |
const joinToArrayOrGetString = (strOrArray1, strOrArray2) => { | |
const ret = [...convertToArray(strOrArray1), ...convertToArray(strOrArray2)].filter(item => typeof item === 'string'); | |
return (ret.length === 1) ? ret[0] : ret; | |
}; |
const convertToArray = any => (Array.isArray(any)) ? any : [any]; |
const fillWithCharBefore = (str, len, chr = '0') => (str.length <= len) ? `${chr.repeat(len - str.length)}${str}` : str; |
const getValuesUnique = arr => [...new Set(arr)]; |
const sortCompare = (a, b, order = 1) => { | |
if (a > b) return order; | |
if (a < b) return order * -1; | |
return 0; | |
}; |
const faq = [ | |
{ | |
outline: "3.2", | |
question: "Hello John?", | |
answer: "Yes!" | |
}, | |
{ | |
outline: "1.1", | |
question: "Hello Julia?", | |
answer: "Hi!" |
/* | |
* getFirstName extracts the first name out of a string of the full name. | |
* Examples (input -> result): | |
* 'Tim Berners-Lee' -> 'Tim' | |
* 'Berners-Lee, Tim' -> 'Tim' | |
* 'Tim' -> 'Tim' | |
* */ | |
const getFirstName = names => { | |
const reg = new RegExp('.*, ([a-zA-Z-]*)|([a-zA-Z-]*) .*', 'i'); | |
const result = reg.exec(names); |
I hereby claim:
To claim this, I am signing this object:
(function app() { | |
const event = { | |
init() { | |
view.$document.ready(this.onDomReady); | |
view.$body.on('keyup', this.onKeyUp) | |
.on('keydown', this.onKeyDown) | |
.on('keypress', this.onKeyPress); | |
this.initPrompt(); | |
view.$window.on('scroll touchmove mousewheel', this.onScroll); | |
}, |