{"version":3,"sources":["../../source/findNumbers/RegExpCache.js"],"names":["RegExpCache","size","cache","LRUCache","pattern","regExp","get","RegExp","put"],"mappings":";;;;;;;AAAA;;;;;;;;;;AAEA;AACA;AACA;AACA;IACqBA,W;;;AACpB,uBAAYC,IAAZ,EAAkB;AAAA;;AACjB,SAAKC,KAAL,GAAa,IAAIC,oBAAJ,CAAaF,IAAb,CAAb;AACA;;;;wCAEmBG,O,EAAS;AAC5B,UAAIC,MAAM,GAAG,KAAKH,KAAL,CAAWI,GAAX,CAAeF,OAAf,CAAb;;AACA,UAAI,CAACC,MAAL,EAAa;AACZA,QAAAA,MAAM,GAAG,IAAIE,MAAJ,CAAW,MAAMH,OAAjB,CAAT;AACA,aAAKF,KAAL,CAAWM,GAAX,CAAeJ,OAAf,EAAwBC,MAAxB;AACA;;AACD,aAAOA,MAAP;AACA","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"}