mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
fix(Collection): make error messages consistent (#8224)
This commit is contained in:
@@ -41,7 +41,7 @@ export class Collection<K, V> extends Map<K, V> {
|
||||
*/
|
||||
public ensure(key: K, defaultValueGenerator: (key: K, collection: this) => V): V {
|
||||
if (this.has(key)) return this.get(key)!;
|
||||
if (typeof defaultValueGenerator !== 'function') throw new TypeError(`${defaultValueGenerator} is not a function.`);
|
||||
if (typeof defaultValueGenerator !== 'function') throw new TypeError(`${defaultValueGenerator} is not a function`);
|
||||
const defaultValue = defaultValueGenerator(key, this);
|
||||
this.set(key, defaultValue);
|
||||
return defaultValue;
|
||||
|
||||
Reference in New Issue
Block a user