# @financial-times/polyfill-useragent-normaliser

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

Latest version **1.10.2** (published 2022-04-05) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @financial-times/polyfill-useragent-normaliser
pnpm add @financial-times/polyfill-useragent-normaliser
yarn add @financial-times/polyfill-useragent-normaliser
bun add @financial-times/polyfill-useragent-normaliser
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.10.2 |
| Published | 2022-04-05 |
| First published | 2019-01-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8 |
| Dependencies | 2 |
| Unpacked size | 366.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | nikita.lohia, notlee, efinlay24, emmalewis, aendra, the-ft, rowanmanning, chee, alexwilson |

## Links

- npm: https://www.npmjs.com/package/@financial-times/polyfill-useragent-normaliser
- Repository: https://github.com/Financial-Times/polyfill-useragent-normaliser
- Homepage: https://github.com/Financial-Times/polyfill-useragent-normaliser#readme
- Issues: https://github.com/Financial-Times/polyfill-useragent-normaliser/issues
- npm.io page: https://npm.io/package/@financial-times/polyfill-useragent-normaliser

## Dependencies (2)

- [semver](https://npm.io/package/semver.md) ^7.1.1
- [@financial-times/useragent_parser](https://npm.io/package/@financial-times/useragent_parser.md) ^1.6.3

## Recent versions

- 1.10.2 (latest) — 2022-04-05
- 2.0.1 — 2022-03-07
- 2.0.0 — 2022-01-10
- 1.10.1 — 2021-08-04
- 1.10.0 — 2021-08-04
- 1.8.1 — 2021-01-22
- 1.8.0 — 2020-12-16
- 1.9.0 — 2020-07-07
- 1.7.0 — 2020-03-19
- 1.6.3 — 2020-01-15
- 1.6.2 — 2020-01-15
- 1.6.1 — 2020-01-15
- 1.6.0 — 2020-01-13
- 1.5.1 — 2020-01-13
- 1.5.0 — 2019-11-15
- … 6 more at https://npm.io/package/@financial-times/polyfill-useragent-normaliser/versions

## README

# polyfill.io User Agent normaliser

This is the VCL & JS implementation of the User-Agent normalisation used within the [polyfill-service](https://github.com/Financial-Times/polyfill-service) and the [polyfill-library](https://github.com/Financial-Times/polyfill-library).

# Usage

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

# Example in VCL
```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

```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
```

---
_Source: https://npm.io/package/@financial-times/polyfill-useragent-normaliser · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
