{"version":3,"sources":["../../source/findNumbers/RegExpCache.js"],"names":["LRUCache","RegExpCache","size","cache","pattern","regExp","get","RegExp","put"],"mappings":";;;;;;AAAA,OAAOA,QAAP,MAAqB,YAArB,C,CAEA;AACA;AACA;AACA;;IACqBC,W;;;AACpB,uBAAYC,IAAZ,EAAkB;AAAA;;AACjB,SAAKC,KAAL,GAAa,IAAIH,QAAJ,CAAaE,IAAb,CAAb;AACA;;;;wCAEmBE,O,EAAS;AAC5B,UAAIC,MAAM,GAAG,KAAKF,KAAL,CAAWG,GAAX,CAAeF,OAAf,CAAb;;AACA,UAAI,CAACC,MAAL,EAAa;AACZA,QAAAA,MAAM,GAAG,IAAIE,MAAJ,CAAW,MAAMH,OAAjB,CAAT;AACA,aAAKD,KAAL,CAAWK,GAAX,CAAeJ,OAAf,EAAwBC,MAAxB;AACA;;AACD,aAAOA,MAAP;AACA;;;;;;SAZmBJ,W","sourcesContent":["import LRUCache from './LRUCache'\r\n\r\n// A cache for frequently used country-specific regular expressions. Set to 32 to cover ~2-3\r\n// countries being used for the same doc with ~10 patterns for each country. Some pages will have\r\n// a lot more countries in use, but typically fewer numbers for each so expanding the cache for\r\n// that use-case won't have a lot of benefit.\r\nexport default class RegExpCache {\r\n\tconstructor(size) {\r\n\t\tthis.cache = new LRUCache(size)\r\n\t}\r\n\r\n\tgetPatternForRegExp(pattern) {\r\n\t\tlet regExp = this.cache.get(pattern)\r\n\t\tif (!regExp) {\r\n\t\t\tregExp = new RegExp('^' + pattern)\r\n\t\t\tthis.cache.put(pattern, regExp)\r\n\t\t}\r\n\t\treturn regExp\r\n\t}\r\n}"],"file":"RegExpCache.js"}