@financial-times/polyfill-useragent-normaliser

The user-agent normalisation logic behind polyfill-library and polyfill.io

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
Last updated 4 years ago by the-ft .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @financial-times/polyfill-useragent-normaliser 
SYNC missed versions from official npm registry.

polyfill.io User Agent normaliser

This is the VCL & JS implementation of the User-Agent normalisation used within the polyfill-service and the polyfill-library.

Usage

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

Example in VCL

import "normalise-user-agent.vcl";

sub vcl_recv {
  call normalise_user_agent_1_0_6;
#   req.http.normalized_user_agent_family = "chrome";
#   req.http.normalized_user_agent_major_version = "71";
#   req.http.normalized_user_agent_minor_version = "1";
#   req.http.normalized_user_agent_patch_version = "0";
#   req.http.Normalized-User-Agent = "chrome/71.1.0";
}

Example in JS

const UA = require('@financial-times/polyfill-useragent-normaliser');

const useragent = new UA(request.headers['user-agent']);
console.log(useragent.isUnknown()); // false
console.log(useragent.satisfies("<50")); // false
console.log(useragent.satisfies(">50")); // true

Current Tags

  • 1.10.2                                ...           latest (4 years ago)

21 Versions

  • 1.10.2 [deprecated]           ...           4 years ago
  • 2.0.1 [deprecated]           ...           4 years ago
  • 2.0.0 [deprecated]           ...           4 years ago
  • 1.10.1 [deprecated]           ...           5 years ago
  • 1.10.0 [deprecated]           ...           5 years ago
  • 1.8.1 [deprecated]           ...           5 years ago
  • 1.8.0 [deprecated]           ...           5 years ago
  • 1.9.0 [deprecated]           ...           6 years ago
  • 1.7.0 [deprecated]           ...           6 years ago
  • 1.6.3 [deprecated]           ...           6 years ago
  • 1.6.2 [deprecated]           ...           6 years ago
  • 1.6.1 [deprecated]           ...           6 years ago
  • 1.6.0 [deprecated]           ...           6 years ago
  • 1.5.1 [deprecated]           ...           6 years ago
  • 1.5.0 [deprecated]           ...           6 years ago
  • 1.4.2 [deprecated]           ...           7 years ago
  • 1.3.0 [deprecated]           ...           7 years ago
  • 1.2.0 [deprecated]           ...           7 years ago
  • 1.1.0 [deprecated]           ...           7 years ago
  • 1.0.6 [deprecated]           ...           7 years ago
  • 1.0.4 [deprecated]           ...           7 years ago
Downloads
Today 0
This Week 1
This Month 23
Last Day 0
Last Week 22
Last Month 3
Dependencies (2)
Dev Dependencies (7)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |