I am migrating a small script from coco to LiveScript:
D = (obj, l = 20) ->
if (l > 0)
new
@[k] = (try D(v, l - 1) catch (e) e) for k, v in obj
else
obj
This code, which is valid in coco, does not compile in LiveScript:
Parse error on line 4: Unexpected 'FOR'
I was trying to modify that code the following way (for LiveScript):
D = (obj, l = 20) ->
if (l > 0)
new
for k, v of obj
@[k] = (try D(v, l - 1) catch (e) e)
else
obj
But still it does not compile:
invalid assign on line 5
How to rewrite this coco script into LiveScript? (Not in the plain JavaScript way -- without using a temporary variable.)