# @financial-times/js-features-analyser

> ## How to use

Latest version **0.4.3** (published 2021-07-09) · MIT license · 0 weekly downloads

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

## Install

```sh
npm install @financial-times/js-features-analyser
pnpm add @financial-times/js-features-analyser
yarn add @financial-times/js-features-analyser
bun add @financial-times/js-features-analyser
```

Provides the command `js-features-analyser`.

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.4.3 |
| Published | 2021-07-09 |
| First published | 2019-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 666.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jake Champion |
| Maintainers | briggsc, the-ft, quarterto, rowanmanning, mattandrews, jakedchampion, i-like-robots, aendrew, sdbernard, bobhaslett, joannaskao, robinmarr-ft, ft-internal-products, chee, notlee, tatiana.stantonian, conor-mullen, alexwilson |

## Links

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

## Dependencies (2)

- [yargs](https://npm.io/package/yargs.md) ^13.3.2
- [@babel/core](https://npm.io/package/@babel/core.md) ^7.13.14

## Recent versions

- 0.4.3 (latest) — 2021-07-09
- 0.4.2 — 2021-01-22
- 0.0.4 — 2019-07-17
- 0.0.3 — 2019-07-17
- 0.0.2 — 2019-07-17
- 0.0.1 — 2019-07-17

## README

# JavaScript Feature Analyser

A Node.js command-line application for figuring out what standard-library features are being used within a JavaScript file.

[![NPM version](https://img.shields.io/npm/v/@financial-times/js-features-analyser.svg)](https://www.npmjs.com/package/@financial-times/js-features-analyser)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)][license]

```bash
> npx @financial-times/js-features-analyser analyse --file bundle.js
```


## Table Of Contents

  - [Usage](#usage)
  - [Limitations](#limitations)
  - [Contributing](#contributing)
  - [Publishing](#publishing)
  - [Contact](#contact)
  - [Licence](#licence)


## Usage

This project requires [Node.js] 10.x and [npm]. You can install with:

```sh
npm install @financial-times/js-features-analyser
```

## Limitations

This project does not compile syntax at all.

Create a bundle which targets the syntax level you support (ES3/5/2017/2019) and then pass that bundle through this tool.

The reason to create the bundle first is because if you are compiling your code down to another syntax level, the compiled code will contain different built-ins than the uncompiled version. E.G. Compiling `async function() { await 7;}` to ES5 will make the compiled output have `Promise` in it, which this tool will then detect.

This project does not know the types that are within the code being analysed, which means that when it sees a name of a builtin being used, it will add all the builtins which match that name to it's output. E.G. Analysing `[1].reduce(function(){})` will not only detect that `Array.prototype.reduce` was used, it would also incorrectly detect that `Int8Array.prototype.reduce`, `Uint8Array.prototype.reduce`, `Uint8ClampedArray.prototype.reduce`, `Int16Array.prototype.reduce`, `Uint16Array.prototype.reduce`, `Int32Array.prototype.reduce`, `Uint32Array.prototype.reduce`, `Float32Array.prototype.reduce`, and `Float64Array.prototype.reduce` were also used.


## Contributing

This module has a full suite of unit tests, and is verified with ESLint. You can use the following commands to check your code before opening a pull request:

```sh
npm test    # verify JavaScript code with ESLint and run the tests
```


## Publishing

New versions of the module are published automatically by CI for every commit which lands on the `master` branch.


## Contact

If you have any questions or comments about this module, or need help using it, please [raise an issue][issues].


## Licence

This software is under the [MIT licence][license].



[issues]: https://github.com/Financial-Times/js-features-analyser/issues
[license]: http://opensource.org/licenses/MIT
[node.js]: https://nodejs.org/
[npm]: https://www.npmjs.com/

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