n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.18k stars 187 forks source link

Displaying function body #44

Closed slavaGanzin closed 9 years ago

slavaGanzin commented 9 years ago

I recently switched to your kernel from notablemind's one. And what I miss for is displaying body of function. I think this is by design but why?

jupyter-nodejs:
> a = -> a
> a
function a ( ) {
return a;
}

and not just [Function a] which is more expected by design of javascript, but meaningless a bit too.

This is quite helpful when you write something functional, composed from small pieces.

n-riesco commented 9 years ago

It is how util.inspect outputs a function. You can get the other output by calling .toString() instead, e.g.:

In[1]: a = -> a Out[1]: [Function] In[2]: a.toString() Out[2]: 'function () {\n return a;\n}'

slavaGanzin commented 9 years ago

So can I add to iJavascript automatically toString application if inspect return [Function ***] ?

n-riesco commented 9 years ago

It's more complicated than that. What output would you like for {a: -> a}?

slavaGanzin commented 9 years ago

Plain js would be preferred.