Question

for example

child.stdout.on \data (buffer) -> 
   result.stdout += buffer

-->

child.stdout.on('data', function(buffer){
  return result.stdout += buffer;
});

and I need it without return. In F# I can add |> ignore how can I handle it in livescript?

Was it helpful?

Solution

You can prepend an ! to the definition of the function:

!(buffer) -> result.stdout += buffer

Alternatively, return void

child.stdout.on \data (buffer) -> 
   result.stdout += buffer
   void

In JavaScript, when you return undefined (void), it is the same as not returning anything.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top