CoffeeScript 2 available now

New major version of JavaScript transcompiler programming language released
19 September 2017   2122

Great news for CoffeeScript fans! New major version is finally available. This new release of the CoffeeScript language and compiler aims to bring CoffeeScript into the modern JavaScript era, closing gaps in compatibility with JavaScript while preserving the clean syntax that is CoffeeScript’s hallmark.

New major features:

  • The CoffeeScript 2 compiler now translates CoffeeScript code into modern JavaScript syntax. So a CoffeeScript => is now output as =>, a CoffeeScript class is now output using the class keyword, and so on. This means you may need to transpile the CoffeeScript compiler’s output.
  • CoffeeScript 2 adds support for async functions syntax, for the future object destructuring syntax, and for JSX. Some features, such as modules (import and export statements), for…of, and tagged template literals were backported into CoffeeScript versions 1.11 and 1.12.
  • All of the above was achieved with very few breaking changes from 1.x. Most current CoffeeScript projects should be able to upgrade with little or no refactoring necessary.

CoffeeScript 2 was developed with two primary goals: remove any incompatibilities with modern JavaScript that might prevent CoffeeScript from being used on a project; and preserve as much backward compatibility as possible.

The following CoffeeScript features were updated in 2.0 to output using modern JavaScript syntax:

  • Modules: import/export
  • Classes: class Animal
  • Async functions: await someFunction()
  • Bound/arrow functions: =>
  • Function default parameters: (options = {}) ->
  • Function splat/rest parameters: (items...) ->
  • Destructuring, for both arrays and objects: [first, second] = items{length} = items
  • Object rest/spread properties: {options..., force: yes}{force, otherOptions...} = options
  • Interpolated strings/template literals (JS backticked strings): "Hello, #{user}!"
  • Tagged template literals: html"<strong>coffee</strong>"
  • JavaScript’s for…of is now available as CoffeeScript’s for…from (we already had a for…of): for n from generatorFunction()

There seem to be two breaking changes that affect a significant number of projects:

  • In CoffeeScript 2, “bare” super (calling super without arguments) is now no longer allowed, and one must use super() or super arguments... instead.
  • References to this/@ cannot occur before a call to super, per the JS spec.

CoffeeScript 2 has added support for the following:

  • JSX
  • Line comments are now output (in CoffeeScript 1 they were discarded)
  • Block comments are now allowed anywhere, enabling static type annotations using Flow’s comment-based syntax

Learn more at official website.  

Frontend News Digest 3 -9.08

Learn this week's latest news and updates of JavaScript, CSS, PHP and related technologies
08 August 2019   626

Greetings! I hope your week went great! Here's new Frontend news digest.

In this digest, you will learn how to improve your procedural code, how to deploy apps to to IBM cloud with Tekton, how to use Immer to manage your React state and much more!

Guides

  • Trigger Firebase Storage Image Resize with Cloud Functions

Tutorial on creating an imager resizer triggered by Firebase Storage

  • Using pipe and compose to improve procedural code

According to the creator, this guide will sohw you how to use pipe and compose to improve the way we write procedural code.

  • Deploying Applications to IBM Cloud Kubernetes via Tekton

This article talks about Tekton, an open-source framework for creating CI/CD systems, and explains how to deploy and use it on the IBM Cloud Kubernetes service

  • Quick Gulp Cache Busting

This tips will allow you to improve your work with Gulp

  • Using Immer for React State Management

Learn how Immer can help you to operate React states

Article

  • Laravel Cloud Source Code on GitHub

Author believes that is a chance to get a glimpse of an application written by the creator of Laravel

Updates

  • Calendario

Library allowing to create flexible calendars

  • Symphony

According to the creators, 113 pull requests were merged (79 in code and 34 in docs) and 55 issues were closed (43 in code and 12 in docs)

Video

  • The Date Object - Getting, Setting & Formatting Dates in JavaScript - Tutorial

  • Simple Slide Show in JavaScript | JavaScript exercises