warnOnce

View sourcewarnOnce(message: string): void

Writes a prefixed warning only once for each message received by this module instance.

A repeated message returns without calling warn. The cache uses the equality provided by Array.prototype.includes and starts with an empty-string sentinel, so warnOnce('') is suppressed on its first call. A new message is cached before warn writes the prefixed warning. The function returns undefined whether it writes or suppresses a warning.

Examples

warnOnce('Unsupported format.')
warnOnce('Unsupported format.') // no second console warning

Parameters

NameDescriptionDefault
message

Warning to write once.

—