mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-17 16:26:39 +03:00
f539147d48
This fixes all the license headers in the main library, which corrects the appearance of the main license in the compiled output. It seems that the `!` in the header forces the compiler to keep it in the output. I believe older compiler releases did this purely based on `@license`. Issue #2638 Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
43 lines
745 B
JavaScript
43 lines
745 B
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
goog.provide('shaka.util.MapUtils');
|
|
|
|
|
|
/**
|
|
* @summary A set of map/object utility functions.
|
|
*/
|
|
shaka.util.MapUtils = class {
|
|
/**
|
|
* @param {!Object.<KEY, VALUE>} object
|
|
* @return {!Map.<KEY, VALUE>}
|
|
* @template KEY,VALUE
|
|
*/
|
|
static asMap(object) {
|
|
const map = new Map();
|
|
for (const key of Object.keys(object)) {
|
|
map.set(key, object[key]);
|
|
}
|
|
|
|
return map;
|
|
}
|
|
|
|
|
|
/**
|
|
* @param {!Map.<KEY, VALUE>} map
|
|
* @return {!Object.<KEY, VALUE>}
|
|
* @template KEY,VALUE
|
|
*/
|
|
static asObject(map) {
|
|
const obj = {};
|
|
map.forEach((value, key) => {
|
|
obj[key] = value;
|
|
});
|
|
|
|
return obj;
|
|
}
|
|
};
|