mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-12-07 06:14:24 +00:00
4af5caed7a
Close gh-2234
21 lines
433 B
JavaScript
21 lines
433 B
JavaScript
export function buildBrowserFromString( str ) {
|
|
const [ browser, versionOrDevice, os, osVersion ] = str.split( "_" );
|
|
|
|
// If the version starts with a colon, it's a device
|
|
if ( versionOrDevice && versionOrDevice.startsWith( ":" ) ) {
|
|
return {
|
|
browser,
|
|
device: versionOrDevice.slice( 1 ),
|
|
os,
|
|
os_version: osVersion
|
|
};
|
|
}
|
|
|
|
return {
|
|
browser,
|
|
browser_version: versionOrDevice,
|
|
os,
|
|
os_version: osVersion
|
|
};
|
|
}
|