Creating instances of these Intl formats is an expensive operation, and the APIs are designed such that developers should re-use format instances instead of always creating new ones. This package is simply to make it easier to create a cache of format instances of a particular type to aid in their reuse.
Under the hood, this package creates a cache key based on the arguments passed to the memoized constructor (it will even order the keys of the options argument) it uses JSON.stringify() to create the string key.
Usage
This package works as an ES6 or Node.js module, in either case it has a single default export function; e.g.:
// In an ES6 module.import memoizeFormatConstructor from 'intl-format-cache';
// In Node.var memoizeFormatConstructor = require('intl-format-cache');
This default export is a factory function which can be passed an Intl format constructor and it will return a memoizer that will create or reuse an Intl format instance and return it.