Skip to content

Instantly share code, notes, and snippets.

@soapie
soapie / repr.coffee
Last active December 22, 2015 02:59 — forked from jacob414/repr.coffee
repr = (o, depth=0, max=2) ->
if depth > max
'<..>'
else
switch typeof o
when 'string' then "\"#{o.replace /"/g, '\\"'}\""
when 'function' then 'function'
when 'object'
if o is null then 'null'
if Array.isArray o