@financial-times/useragent_parser

1.6.3 • Public • Published

User Agent parser in VCL & JS

This is the VCL & JS implementation of the ua-parser

Usage

Updating

uap-core definitions are, by default, compiled and included in the package. Updating uap-core is done every day via a GitHub Action.

Example in VCL

For a request which was the user-agent Chrome 71.1:

import ua_parser;

sub vcl_recv {
  call useragent_parser;
  # req.http.useragent_parser_family = "chrome";
  # req.http.useragent_parser_major = "71";
  # req.http.useragent_parser_minor = "1";
  # req.http.useragent_parser_patch = "0";
}

Example in JS

const useragent = require('@financial-times/useragent_parser');

console.log(useragent(request.headers['user-agent']))
/*
  {
    family: 'chrome',
    major: 71,
    minor: 1,
    patch: 0
  }
*/

Readme

Keywords

none

Package Sidebar

Install

npm i @financial-times/useragent_parser

Weekly Downloads

74,232

Version

1.6.3

License

MIT

Unpacked Size

9.29 MB

Total Files

31

Last publish

Collaborators

  • robertboulton
  • seraph2000
  • hamza.samih
  • notlee
  • emmalewis
  • aendra
  • the-ft
  • rowanmanning
  • chee
  • alexwilson