Assignment Destructuring - caffeine-suite/caffeine-script GitHub Wiki
See Destructuring for an overview. See also: Extract-Destructuring, Structuring and Restructuring
Destructuring-Assignment (with Brackets) - JavaScript-Style and CoffeeScript-Style
CaffeineScript fully supports JavaScript destructuring syntax and semantics with one important difference. Ellipsis (...) comes after, not before. This is CoffeeScript-style as well as common English usage.
Examples
[a, b] = [10, 20]
# a == 10, b == 20
[a, b, rest...] = 10, 20, 30, 40, 50
# a == 10, b == 20, c == 30, 40, 50
{a, b} = a: 10, b: 20
# a == 10, b == 20
NOTE: CoffeeScript destructuring features which are not supported by JavaScript, e.g. an ellipsis on a non-last array element: [a..., b] = c
, are not supported in CaffeineScript either... yet.