Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getFormatter(flavor) {
// `Intl.RelativeTimeFormat` instance creation is assumed a
// lengthy operation so the instances are cached and reused.
return this.relativeTimeFormatCache.get(this.locale, flavor) ||
this.relativeTimeFormatCache.put(this.locale, flavor, new RelativeTimeFormat(this.locale, { style: flavor }))
}