# decaffeinate-parser

> A better AST for CoffeeScript, inspired by CoffeeScriptRedux.

Latest version **23.0.1** (published 2022-06-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install decaffeinate-parser
pnpm add decaffeinate-parser
yarn add decaffeinate-parser
bun add decaffeinate-parser
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 23.0.1 |
| Published | 2022-06-18 |
| First published | 2015-10-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6 |
| Dependencies | 6 |
| Unpacked size | 279.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 23 |
| Author | Brian Donovan |
| Maintainers | eventualbuddha, decaffeinate-bot |
| Keywords | ast, coffeescript, parse |

## Links

- npm: https://www.npmjs.com/package/decaffeinate-parser
- Repository: https://github.com/decaffeinate/decaffeinate-parser
- Homepage: https://github.com/decaffeinate/decaffeinate-parser#readme
- Issues: https://github.com/decaffeinate/decaffeinate-parser/issues
- npm.io page: https://npm.io/package/decaffeinate-parser

## Dependencies (6)

- [coffee-lex](https://npm.io/package/coffee-lex.md) ^9.3.1
- [@babel/types](https://npm.io/package/@babel/types.md) ^7.18.4
- [@codemod/parser](https://npm.io/package/@codemod/parser.md) ^1.2.1
- [lines-and-columns](https://npm.io/package/lines-and-columns.md) ^2.0.3
- [decaffeinate-coffeescript](https://npm.io/package/decaffeinate-coffeescript.md) ^1.12.7-patch.4
- [decaffeinate-coffeescript2](https://npm.io/package/decaffeinate-coffeescript2.md) ^2.2.1-patch.6

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 23.0.1 (latest) — 2022-06-18
- 23.0.0 — 2022-06-11
- 22.5.18 — 2022-06-09
- 22.5.17 — 2022-06-07
- 22.5.16 — 2022-06-07
- 22.5.15 — 2021-05-09
- 22.5.14 — 2019-09-26
- 22.5.13 — 2019-09-11
- 22.5.12 — 2019-07-24
- 22.5.11 — 2019-02-13
- 22.5.10 — 2019-02-12
- 22.5.9 — 2019-02-12
- 22.5.8 — 2019-02-12
- 22.5.7 — 2018-12-24
- 22.5.6 — 2018-12-09
- … 141 more at https://npm.io/package/decaffeinate-parser/versions

## README

# decaffeinate-parser [![CI](https://github.com/decaffeinate/decaffeinate-parser/actions/workflows/ci.yml/badge.svg)](https://github.com/decaffeinate/decaffeinate-parser/actions/workflows/ci.yml) [![package version](https://badge.fury.io/js/decaffeinate-parser.svg)](https://badge.fury.io/js/decaffeinate-parser)

This project uses the [official CoffeeScript
parser](https://github.com/jashkenas/coffeescript) to parse CoffeeScript source
code, then maps the AST generated by the parser to one more suitable for the
[decaffeinate project](https://github.com/eventualbuddha/decaffeinate) (based on
the AST generated by
[CoffeeScriptRedux](https://github.com/michaelficarra/CoffeeScriptRedux)).

This project might be useful to anyone who wants to work with a CoffeeScript
AST and prefers working with a saner AST.

## Install

```bash
# via yarn
$ yarn add decaffeinate-parser
# via npm
$ npm install decaffeinate-parser
```

## Usage

This example gets the names of the parameters in the `add` function:

```js
import { parse } from 'decaffeinate-parser';

const program = parse('add = (a, b) -> a + b');
const assignment = program.body.statements[0];
const fn = assignment.expression;

console.log(fn.parameters.map((param) => param.data)); // [ 'a', 'b' ]
```

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