mirror of
https://github.com/jashkenas/coffeescript.git
synced 2026-02-16 02:24:57 -05:00
Enchancing pattern matching with @vars ... issue #721
This commit is contained in:
@@ -142,3 +142,17 @@ ok a is 101
|
||||
|
||||
[x] = {0: y} = {'0': z} = [Math.random()]
|
||||
ok x is y is z, 'destructuring in multiple'
|
||||
|
||||
|
||||
# Destructuring into an object.
|
||||
obj =
|
||||
func: (list, object) ->
|
||||
[@one, @two] = list
|
||||
{@a, @b} = object
|
||||
|
||||
obj.func [1, 2], a: 'a', b: 'b'
|
||||
|
||||
eq obj.one, 1
|
||||
eq obj.two, 2
|
||||
eq obj.a, 'a'
|
||||
eq obj.b, 'b'
|
||||
|
||||
Reference in New Issue
Block a user