Closed opablo closed 5 months ago
Thank you for this valuable suggestion, it's now possible to combine multiple extensions easily
import { UAParser } from 'ua-parser-js';
import { Bots, Emails, InApps, MediaPlayers } from 'ua-parser-js/extensions';
const userAgent = 'curl/7.38.0';
const uaParser = new UAParser(userAgent, [Bots, Emails, InApps, MediaPlayers]);
const uaParams = uaParser.getResult();
While reading the 2.0.0-beta documentation here: https://docs.uaparser.js.org/v2/api/submodules/extensions/overview.html
I learned that the required way of combining multiple Extensions is like this:
it would be so much intuitive and simple to use if the library supports simply this:
as an example of how ugly it can get... I wanted to implement the parsing of all possible known user agents and my code ended up like this:
when it could have been as intuitive and simple as this: