Forrest logo
tool overview
On this page you find all important commands for the CLI tool decaffeinate. If the command you are looking for is missing please ask our AI.

decaffeinate

Decaffeinate is a command line tool used to convert CoffeeScript code to modern JavaScript. CoffeeScript is a programming language that transcompiles into JavaScript, providing a more concise and readable syntax. However, as JavaScript evolved, many of the features introduced in ECMAScript 6 (ES6) and later versions were not fully supported by CoffeeScript.

To address this limitation, decaffeinate was created. It performs an automated transformation of CoffeeScript code into equivalent JavaScript, taking advantage of the latest language features. Decompiling CoffeeScript can be useful in migrating existing projects to ES6 or optimizing performance.

Decaffeinate provides various options to customize the conversion process, such as preserving or transforming classes, template strings, arrow functions, and more. It also offers a safe mode option to create conservative conversions, avoiding potentially unsafe transformations that might change the behavior of the code.

While decaffeinate aims to deliver a reliable conversion tool, it's important to note that not all CoffeeScript features have direct JavaScript equivalents. Manual adjustments and code reviews may be required after the decaffeination process to ensure correct functionality.

Overall, decaffeinate streamlines the task of converting CoffeeScript code to modern JavaScript, allowing developers to leverage the latest language advancements and better integrate their projects into the evolving JavaScript ecosystem.

List of commands for decaffeinate:

  • decaffeinate:tldr:30a17 decaffeinate: Convert a CoffeeScript, allowing named exports.
    $ decaffeinate --loose-js-modules ${filename-coffee}
    try on your machine
    explain this command
  • decaffeinate:tldr:560f7 decaffeinate: Convert a CoffeeScript file to JavaScript.
    $ decaffeinate ${filename-coffee}
    try on your machine
    explain this command
  • decaffeinate:tldr:838c3 decaffeinate: Convert a CoffeeScript v2 file to JavaScript.
    $ decaffeinate --use-cs2 ${filename-coffee}
    try on your machine
    explain this command
  • decaffeinate:tldr:852e8 decaffeinate: Convert require and `module.exports` to import and export.
    $ decaffeinate --use-js-modules ${filename-coffee}
    try on your machine
    explain this command
tool overview