1
0
Fork 0

add additional typings to collection

refactor/models
Matthew 2019-10-31 20:38:19 -04:00
parent 633f380cb8
commit ef3919ce92
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 2 additions and 2 deletions

View File

@ -110,7 +110,7 @@ export default class Collection<V> extends Map<string, V> {
*/ */
reduce(func: Function, initialValue = 0) { reduce(func: Function, initialValue = 0) {
const iter = this.values(); const iter = this.values();
let val; let val: any;
let result = initialValue === undefined ? iter.next().value : initialValue; let result = initialValue === undefined ? iter.next().value : initialValue;
while ((val = iter.next().value) !== undefined) { // eslint-disable-line while ((val = iter.next().value) !== undefined) { // eslint-disable-line
result = func(result, val); result = func(result, val);
@ -159,7 +159,7 @@ export default class Collection<V> extends Map<string, V> {
* @param key The key of the object * @param key The key of the object
* @returns The removed object, or `null` if nothing was removed * @returns The removed object, or `null` if nothing was removed
*/ */
remove(key): V { remove(key: string): V {
const item = this.get(key); const item = this.get(key);
if (!item) { if (!item) {
return null; return null;