bowser-cache
Cache Bowser lookups in LRU
Usage
This module uses bowser
to parse user agent (ua) strings, and puts the result into an LRU cache. This
cache holds up to 100 cache entries.
API
The default export caches the raw form returned by bowser
.
; const parsedInfo = ; // Do something with `parsedInfo`
You can also provide a transformation function to massage the data before it's put into the cache.
; const bowserCache = ; const parsedInfo = ; // `parsedInfo` is now just { isMobile: true|false }
Additionally, you can specify custom cache size (default is 100).
; // Cache will have a maximum of 10 entriesconst bowserCache = ; const parsedInfo = ; // Do something with `parsedInfo`
; // Cache will have a maximum of 10 entriesconst bowserCache = ; const parsedInfo = ; // `parsedInfo` is now just { isMobile: true|false }