module Opal::Nodes::Helpers

def mid_to_jsid(mid)

wrapped in brackets to use reference notation calling.
have a '.' prefix (for dot-calling), otherwise it will be
a '$', and if the name is a valid javascript identifier, it will
a method/function call. All ruby method names get prefixed with
Converts a ruby method name into its javascript equivalent for
def mid_to_jsid(mid)
  if %r{\=|\+|\-|\*|\/|\!|\?|<|\>|\&|\||\^|\%|\~|\[|`} =~ mid.to_s
    "['$#{mid}']"
  else
    '.$' + mid
  end
end