Repository URL to install this package:
|
Version:
5.1.0-rc.0 ▾
|
<!doctype html>
<html lang="en">
<head>
<title>Code coverage report for src/utils.js</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="../prettify.css" />
<link rel="stylesheet" href="../base.css" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type='text/css'>
.coverage-summary .sorter {
background-image: url(../sort-arrow-sprite.png);
}
</style>
</head>
<body>
<div class='wrapper'>
<div class='pad1'>
<h1>
<a href="../index.html">All files</a> / <a href="index.html">src</a> utils.js
</h1>
<div class='clearfix'>
</div>
</div>
<div class='status-line high'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">1x</span>
<span class="cline-any cline-yes">5x</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">19x</span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-neutral"> </span>
<span class="cline-any cline-yes">9x</span>
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
* Get locale from browser
*
* @returns {string} browser locale, i.e. `en`, `en-US`, `fr`, ...
*/
export const getNavigatorLocale = () =>
navigator.language || <span class="branch-1 cbranch-no" title="branch not covered" >navigator.userLanguage </span>|| <span class="branch-2 cbranch-no" title="branch not covered" >navigator.browserLanguage </span>|| <span class="branch-3 cbranch-no" title="branch not covered" >navigator.systemLanguage;</span>
/**
* normalize locale to dashes
*
* @param {string} locale
* @returns {string} locale
*/
export const normalizeLocale = locale => (locale || '').replace('_', '-');
/**
* extract the language code from a normalized locale
*
* @param {string} locale normalized locale: i.e. `en-US`, `de-CH`
* @returns {string} language code, i.e. `en`, `de`
*/
export const getLanguageCodeFromLocale = locale => (locale || '').split('-')[0];
</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
Code coverage
generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Mar 08 2021 14:04:33 GMT+0100 (Central European Standard Time)
</div>
</div>
<script src="../prettify.js"></script>
<script>
window.onload = function () {
if (typeof prettyPrint === 'function') {
prettyPrint();
}
};
</script>
<script src="../sorter.js"></script>
</body>
</html>