Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | 21x 21x 28x 460x 460x | /**
* MultiScannerElement Utils
*
* Utility Functions
*/
/**
* Converts a snake case (or hyphenated) string to camel case.
*
* @param str
*/
function snakeToCamel(str) {
Iif (!/[_-]/.test(str)) return str;
return str
.toLowerCase()
.replace(/([-_])([a-z])/g, (_match, _p1, p2) => p2.toUpperCase());
}
/**
* Joins a camel case string with a provided char.
*
* @param str
* @param char
*/
function camelJoin(str, char = '-') {
const result = str.replace(/([A-Z])/g, ' $1');
return result.split(' ').join(char).toLowerCase();
}
// Begin UTILITY method /getOS/
/**
* Gets the Current operating system.
*
* @memberof sg.util
* @protected
* @function
* @returns {string} - Type of OS.
*/
function getOS() {
const userAgent = window.navigator.userAgent;
const platform = window.navigator.platform;
const macosPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'];
const windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'];
const iosPlatforms = ['iPhone', 'iPad', 'iPod'];
let os = null;
if (macosPlatforms.indexOf(platform) !== -1) {
os = 'Mac OS';
} else if (iosPlatforms.indexOf(platform) !== -1) {
os = 'iOS';
} else if (windowsPlatforms.indexOf(platform) !== -1) {
os = 'Windows';
} else if (/Android/.test(userAgent)) {
os = 'Android';
} else if (!os && /Linux/.test(platform)) {
os = 'Linux';
}
return os;
}
// END-- UTILITY method /getOS/
export { snakeToCamel, camelJoin };
|