node_modules updated, buefy add to lib folder

This commit is contained in:
2019-06-04 14:29:48 +02:00
parent 0a3f6ff240
commit 5d28bc36e1
3957 changed files with 306575 additions and 21738 deletions
+89
View File
@@ -0,0 +1,89 @@
/**
* Get value of an object property/path even if it's nested
*/
export function getValueByPath(obj, path) {
const value = path.split('.').reduce((o, i) => o[i], obj)
return value
}
/**
* Extension of indexOf method by equality function if specified
*/
export function indexOf(array, obj, fn) {
if (!array) return -1
if (!fn || typeof fn !== 'function') return array.indexOf(obj)
for (let i = 0; i < array.length; i++) {
if (fn(array[i], obj)) {
return i
}
}
return -1
}
/**
* Mobile detection
* https://www.abeautifulsite.net/detecting-mobile-devices-with-javascript
*/
export const isMobile = {
Android: function () {
return (
typeof window !== 'undefined' &&
window.navigator.userAgent.match(/Android/i)
)
},
BlackBerry: function () {
return (
typeof window !== 'undefined' &&
window.navigator.userAgent.match(/BlackBerry/i)
)
},
iOS: function () {
return (
typeof window !== 'undefined' &&
window.navigator.userAgent.match(/iPhone|iPad|iPod/i)
)
},
Opera: function () {
return (
typeof window !== 'undefined' &&
window.navigator.userAgent.match(/Opera Mini/i)
)
},
Windows: function () {
return (
typeof window !== 'undefined' &&
window.navigator.userAgent.match(/IEMobile/i)
)
},
any: function () {
return (
isMobile.Android() ||
isMobile.BlackBerry() ||
isMobile.iOS() ||
isMobile.Opera() ||
isMobile.Windows()
)
}
}
export function removeElement(el) {
if (typeof el.remove !== 'undefined') {
el.remove()
} else if (typeof el.parentNode !== 'undefined') {
el.parentNode.removeChild(el)
}
}
/**
* Escape regex characters
* http://stackoverflow.com/a/6969486
*/
export function escapeRegExpChars(value) {
if (!value) return value
// eslint-disable-next-line
return value.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&')
}