 
   getCancellableCallback:(callback)->
     cancelled = no
-    kallback = (rest...)->
-      callback rest... unless cancelled
+    kallback = (rest...)-> callback rest...  unless cancelled
     kallback.cancel = -> cancelled = yes
     kallback
 

  defer:do ->
    # this was ported from browserify's implementation of "process.nextTick"
    queue = []
    canPost = window?.postMessage and window.addEventListener
    if canPost
      window.addEventListener "message", ((ev) ->
        if ev.source is window and ev.data is "kd-tick"
          ev.stopPropagation()
          if queue.length > 0
            fn = queue.shift()
            fn()
      ), true
      (fn) ->
        queue.push fn
        window.postMessage "kd-tick", "*"
    else
      (fn) -> setTimeout fn, 0

  wait: (duration, fn) ->
    if "function" is typeof duration

    tryToShorten = (longText, optimalBreak, suffix)->
      unless ~ longText.indexOf optimalBreak then no
      else
        "#{longText.split(optimalBreak).slice(0, -1).join optimalBreak}#{suffix ? optimalBreak}"
    (longText, options={})->
      return unless longText
      minLength = options.minLength or 450
