# platform

> A platform detection library that works on nearly all JavaScript platforms.

Latest version **1.3.6** (published 2020-07-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install platform
pnpm add platform
yarn add platform
bun add platform
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.6 |
| Published | 2020-07-04 |
| First published | 2011-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/platform) |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 45.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3243 |
| Author | Benjamin Tan |
| Maintainers | d10, jdalton, mathias |
| Keywords | environment, platform, ua, useragent |

## Links

- npm: https://www.npmjs.com/package/platform
- Repository: https://github.com/bestiejs/platform.js
- Homepage: https://github.com/bestiejs/platform.js#readme
- Issues: https://github.com/bestiejs/platform.js/issues
- npm.io page: https://npm.io/package/platform

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.3.6 (latest) — 2020-07-04
- 1.3.5 — 2018-01-23
- 1.3.4 — 2017-03-30
- 1.3.3 — 2016-11-10
- 1.3.2 — 2016-11-01
- 1.3.1 — 2016-01-01
- 1.3.0 — 2014-12-01
- 1.2.0 — 2014-06-23
- 1.1.0 — 2014-05-26
- 1.0.0 — 2012-08-15
- 0.4.0 — 2011-11-22
- 0.3.1 — 2011-11-13
- 0.3.0 — 2011-11-13
- 0.2.0 — 2011-11-13
- 0.1.337 — 2011-11-13

## README

# Platform.js v1.3.5

A platform detection library that works on nearly all JavaScript platforms.

## Disclaimer

Platform.js is for informational purposes only & **not** intended as a substitution for feature detection/inference checks.

## Documentation

* [doc/README.md](https://github.com/bestiejs/platform.js/blob/master/doc/README.md#readme)
* [wiki/Changelog](https://github.com/bestiejs/platform.js/wiki/Changelog)
* [wiki/Roadmap](https://github.com/bestiejs/platform.js/wiki/Roadmap)
* [platform.js demo](https://bestiejs.github.io/platform.js/) (See also [whatsmyua.info](https://www.whatsmyua.info/) for comparisons between platform.js and other platform detection libraries)

## Installation

In a browser:

```html
<script src="platform.js"></script>
```

In an AMD loader:

```js
require(['platform'], function(platform) {/*…*/});
```

Using npm:

```shell
$ npm i --save platform
```

In Node.js:

```js
var platform = require('platform');
```

Usage example:

```js
// on IE10 x86 platform preview running in IE7 compatibility mode on Windows 7 64 bit edition
platform.name; // 'IE'
platform.version; // '10.0'
platform.layout; // 'Trident'
platform.os; // 'Windows Server 2008 R2 / 7 x64'
platform.description; // 'IE 10.0 x86 (platform preview; running in IE 7 mode) on Windows Server 2008 R2 / 7 x64'

// or on an iPad
platform.name; // 'Safari'
platform.version; // '5.1'
platform.product; // 'iPad'
platform.manufacturer; // 'Apple'
platform.layout; // 'WebKit'
platform.os; // 'iOS 5.0'
platform.description; // 'Safari 5.1 on Apple iPad (iOS 5.0)'

// or parsing a given UA string
var info = platform.parse('Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7.2; en; rv:2.0) Gecko/20100101 Firefox/4.0 Opera 11.52');
info.name; // 'Opera'
info.version; // '11.52'
info.layout; // 'Presto'
info.os; // 'Mac OS X 10.7.2'
info.description; // 'Opera 11.52 (identifying as Firefox 4.0) on Mac OS X 10.7.2'
```

## Support

Tested in Chrome 82-83, Firefox 77-78, IE 11, Edge 82-83, Safari 12-13, Node.js 4-14, & PhantomJS 2.1.1.

## BestieJS

Platform.js is part of the BestieJS *“Best in Class”* module collection. This means we promote solid browser/environment support, ES5+ precedents, unit testing, & plenty of documentation.

---
_Source: https://npm.io/package/platform · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
