Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

18 lines (15 sloc) 0.655 kb
# Cofeescript Plugin that makes all top level varibles globals. Coffeescript generated
# vars are ignored.
puts = (arg) -> console.log arg
getLines = (line) ->
line.replace('var ', '').replace(';', '').trim().split /\s*,\s*/
addToTheEnd = (array, addedArray) ->
addedArray.unshift(-2, 0)
Array.prototype.splice.apply array, addedArray
CoffeeScript.on 'success', (task) ->
lines = task.output.split(/\n/)
containsEqual = lines[1].indexOf("=") >= 0
variables = if containsEqual then [] else getLines(lines[1])
newLines = "window.#{v} = #{v}" for v in variables
addToTheEnd lines, newLines
task.output = lines.join "\n"
Jump to Line
Something went wrong with that request. Please try again.