mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: Use Typescript to lint JSDoc annotations (#986)
This patch starts using typescript to lint JSDoc annotations. Note: this uses typescript's bleeding edge. We should migrate to stable once it has all the necessary bugfixes. References #65.
This commit is contained in:
committed by
Andrey Lushnikov
parent
7b5d7ddac2
commit
e59172de83
@@ -14,19 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template K, V
|
||||
*/
|
||||
class Multimap {
|
||||
constructor() {
|
||||
/** @type {!Map<K, !Set<!V>>} */
|
||||
this._map = new Map();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {K} key
|
||||
* @param {V} value
|
||||
*/
|
||||
set(key, value) {
|
||||
let set = this._map.get(key);
|
||||
if (!set) {
|
||||
@@ -36,10 +28,6 @@ class Multimap {
|
||||
set.add(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {K} key
|
||||
* @return {!Set<!V>}
|
||||
*/
|
||||
get(key) {
|
||||
let result = this._map.get(key);
|
||||
if (!result)
|
||||
@@ -47,19 +35,10 @@ class Multimap {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {K} key
|
||||
* @return {boolean}
|
||||
*/
|
||||
has(key) {
|
||||
return this._map.has(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {K} key
|
||||
* @param {V} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
hasValue(key, value) {
|
||||
const set = this._map.get(key);
|
||||
if (!set)
|
||||
@@ -74,11 +53,6 @@ class Multimap {
|
||||
return this._map.size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {K} key
|
||||
* @param {V} value
|
||||
* @return {boolean}
|
||||
*/
|
||||
delete(key, value) {
|
||||
const values = this.get(key);
|
||||
const result = values.delete(value);
|
||||
@@ -87,17 +61,10 @@ class Multimap {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {K} key
|
||||
*/
|
||||
deleteAll(key) {
|
||||
this._map.delete(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {K} key
|
||||
* @return {?V} value
|
||||
*/
|
||||
firstValue(key) {
|
||||
const set = this._map.get(key);
|
||||
if (!set)
|
||||
@@ -105,16 +72,10 @@ class Multimap {
|
||||
return set.values().next().value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {K}
|
||||
*/
|
||||
firstKey() {
|
||||
return this._map.keys().next().value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {!Array<!V>}
|
||||
*/
|
||||
valuesArray() {
|
||||
const result = [];
|
||||
for (const key of this._map.keys())
|
||||
@@ -122,9 +83,6 @@ class Multimap {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {!Array<!K>}
|
||||
*/
|
||||
keysArray() {
|
||||
return Array.from(this._map.keys());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user