mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-14 15:56:38 +03:00
Prefer const over let.
A coming update to the Google eslint config will require using "const" over "let". This makes that one change to isolate the big changes. Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
This commit is contained in:
@@ -38,9 +38,9 @@ goog.require('shaka.util.StringUtils');
|
||||
*/
|
||||
shaka.util.Uint8ArrayUtils.toBase64 = function(arr, padding) {
|
||||
// btoa expects a "raw string" where each character is interpreted as a byte.
|
||||
let bytes = shaka.util.StringUtils.fromCharCode(arr);
|
||||
const bytes = shaka.util.StringUtils.fromCharCode(arr);
|
||||
padding = (padding == undefined) ? true : padding;
|
||||
let base64 = window.btoa(bytes).replace(/\+/g, '-').replace(/\//g, '_');
|
||||
const base64 = window.btoa(bytes).replace(/\+/g, '-').replace(/\//g, '_');
|
||||
return padding ? base64 : base64.replace(/=*$/, '');
|
||||
};
|
||||
|
||||
@@ -54,8 +54,8 @@ shaka.util.Uint8ArrayUtils.toBase64 = function(arr, padding) {
|
||||
*/
|
||||
shaka.util.Uint8ArrayUtils.fromBase64 = function(str) {
|
||||
// atob creates a "raw string" where each character is interpreted as a byte.
|
||||
let bytes = window.atob(str.replace(/-/g, '+').replace(/_/g, '/'));
|
||||
let result = new Uint8Array(bytes.length);
|
||||
const bytes = window.atob(str.replace(/-/g, '+').replace(/_/g, '/'));
|
||||
const result = new Uint8Array(bytes.length);
|
||||
for (let i = 0; i < bytes.length; ++i) {
|
||||
result[i] = bytes.charCodeAt(i);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ shaka.util.Uint8ArrayUtils.fromBase64 = function(str) {
|
||||
* @export
|
||||
*/
|
||||
shaka.util.Uint8ArrayUtils.fromHex = function(str) {
|
||||
let arr = new Uint8Array(str.length / 2);
|
||||
const arr = new Uint8Array(str.length / 2);
|
||||
for (let i = 0; i < str.length; i += 2) {
|
||||
arr[i / 2] = window.parseInt(str.substr(i, 2), 16);
|
||||
}
|
||||
@@ -125,7 +125,7 @@ shaka.util.Uint8ArrayUtils.concat = function(...varArgs) {
|
||||
totalLength += varArgs[i].length;
|
||||
}
|
||||
|
||||
let result = new Uint8Array(totalLength);
|
||||
const result = new Uint8Array(totalLength);
|
||||
let offset = 0;
|
||||
for (let i = 0; i < varArgs.length; ++i) {
|
||||
result.set(varArgs[i], offset);
|
||||
|
||||
Reference in New Issue
Block a user