Prompt:
obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj[@CHARKEY].match(/^\s*$/)
        delete obj[@CHARKEY]
      else
        obj[@CHARKEY] = obj[@CHARKEY].trim() if options.trim
        obj[@CHARKEY] = obj[@CHARKEY].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and @CHARKEY of obj and not @EXPLICIT_CHARKEY
          obj = obj[@CHARKEY]

      if options.emptyTag != undefined && isEmpty obj
        obj = options.emptyTag

      # check whether we closed all the open tags
      if stack.length > 0

Response:
if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        # if explicitRoot was specified, wrap stuff in the root tag name
        if options.explicitRoot
          # avoid circular references
          old = obj
          obj = {}
          obj[nodeName] = old

        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s[@CHARKEY] += text

  parseString: (str) =>


Response:
class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }

    # emit one error event if the sax parser fails. this is mostly a hack, but
    # the sax parser isn't state of the art either.
    err = false
    @saxParser.onerror = (error) =>
      if ! err
        err = true
        @emit "error", error

    # always use the '#' key, even if there are no subkeys
    # setting this property by and is deprecated, yet still supported.
    # better pass it as explicitCharkey option to the constructor
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]


Prompt:
class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }

    # emit one error event if the sax parser fails. this is mostly a hack, but
    # the sax parser isn't state of the art either.
    err = false
    @saxParser.onerror = (error) =>
      if ! err

Response:
err = true
        @emit "error", error

    # always use the '#' key, even if there are no subkeys
    # setting this property by and is deprecated, yet still supported.
    # better pass it as explicitCharkey option to the constructor
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]


Response:
delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if options.emptyTag != undefined && isEmpty obj
        obj = options.emptyTag

      # check whether we closed all the open tags
      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        # if explicitRoot was specified, wrap stuff in the root tag name
        if options.explicitRoot
          # avoid circular references
          old = obj
          obj = {}
          obj[nodeName] = old

        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if options.emptyTag != undefined && isEmpty obj
        obj = options.emptyTag

      # check whether we closed all the open tags
      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array

Response:
s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        # if explicitRoot was specified, wrap stuff in the root tag name
        if options.explicitRoot
          # avoid circular references
          old = obj
          obj = {}
          obj[nodeName] = old

        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if options.emptyTag != undefined && isEmpty obj
        obj = options.emptyTag

      # check whether we closed all the open tags
      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if options.emptyTag != undefined && isEmpty obj
        obj = options.emptyTag

      # check whether we closed all the open tags
      if stack.length > 0

Response:
if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj

Response:
else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
sax = require 'sax'
events = require 'events'

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }
    # always use the '#' key, even if there are no subkeys
    # setting this property by and is deprecated, yet still supported.
    # better pass it as explicitCharkey option to the constructor
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]


Prompt:
sax = require 'sax'
events = require 'events'

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }
    # always use the '#' key, even if there are no subkeys
    # setting this property by and is deprecated, yet still supported.
    # better pass it as explicitCharkey option to the constructor

Response:
@EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]


Response:
else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else

Response:
old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }
    # always use the '#' key, even if there are no subkeys
    # setting this property by and is deprecated, yet still supported.
    # better pass it as explicitCharkey option to the constructor
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)


Prompt:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }
    # always use the '#' key, even if there are no subkeys
    # setting this property by and is deprecated, yet still supported.

Response:
# better pass it as explicitCharkey option to the constructor
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)


Response:
delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
delete obj["#"]
      else
        obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj

Response:
else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else


Prompt:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options. for compatibility's sake set to some
    # sub-optimal settings. might change in the future.
    options =
      explicitCharkey: false
      trim: true
      # normalize implicates trimming, just so you know
      normalize: true
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the SAX parser. tried trim and normalize, but they are not
    # very helpful
    @saxParser = sax.parser true, {
      trim: false,
      normalize: false
    }
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = options.explicitCharkey

Response:
@resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else


Response:
obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()
```

Response:
var obj, old;

// also do away with '#' key altogether, if there's no subkeys
// unless EXPLICIT_CHARKEY is set
obj["#"] = obj["#"].trim()(options.trim ? (options.normalize ? obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() : void 0, Object.keys(obj).length === 1 && "#" in obj && !this.EXPLICIT_CHARKEY ? obj = obj["#"] : void 0) : void 0);

if (stack.length > 0) {
  if (!(nodeName in s)) {
    s[nodeName] = obj;
  } else if (s[nodeName] instanceof Array) {
    s[nodeName].push(obj);
  } else {
    old = s[nodeName];
    s[nodeName] = [old];
    s[nodeName].push(obj);
  }
} else {
  this.resultObject = obj;
  this.emit("end", this.resultObject);
}

this.saxParser.ontext = this.saxParser.oncdata = (text) => {
  var s;
  s = stack[stack.length - 1];
  if (s) {
    return s["#"] += text;
  }
};

({
  parseString: (str) => {
    return this.saxParser.write(str.toString());
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var obj, old;

// also do away with '#' key altogether, if there's no subkeys
// unless EXPLICIT_CHARKEY is set
obj["#"] = obj["#"].trim()(options.trim ? (options.normalize ? obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() : void 0, Object.keys(obj).length === 1 && "#" in obj && !this.EXPLICIT_CHARKEY ? obj = obj["#"] : void 0) : void 0);

if (stack.length > 0) {
  if (!(nodeName in s)) {
    s[nodeName] = obj;
  } else if (s[nodeName] instanceof Array) {
    s[nodeName].push(obj);
  } else {
    old = s[nodeName];
    s[nodeName] = [old];
    s[nodeName].push(obj);
  }
} else {
  this.resultObject = obj;
  this.emit("end", this.resultObject);
}

this.saxParser.ontext = this.saxParser.oncdata = (text) => {
  var s;
  s = stack[stack.length - 1];
  if (s) {
    return s["#"] += text;
  }
};

({
  parseString: (str) => {
    return this.saxParser.write(str.toString());
  }
});
```

Response:
obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
obj["#"] = obj["#"].trim() if options.trim
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim() if options.normalize
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else

Response:
old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options
    options =
      explicitCharkey: false
      trim: false
      normalize: false
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the sax parser
    @saxParser = sax.parser true
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        # turn 2 or more spaces into one space
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]


Prompt:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: (opts) ->

    # default options
    options =
      explicitCharkey: false
      trim: false
      normalize: false
    # overwrite them with the specified options, if any
    options[key] = value for own key, value of opts

    # make the sax parser
    @saxParser = sax.parser true
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = options.explicitCharkey
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""

Response:
for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        # turn 2 or more spaces into one space
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]


Response:
if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()
```

Response:
var old;

if (stack.length > 0) {
  if (!(nodeName in s)) {
    s[nodeName] = obj;
  } else if (s[nodeName] instanceof Array) {
    s[nodeName].push(obj);
  } else {
    old = s[nodeName];
    s[nodeName] = [old];
    s[nodeName].push(obj);
  }
} else {
  this.resultObject = obj;
  this.emit("end", this.resultObject);
}

this.saxParser.ontext = this.saxParser.oncdata = (text) => {
  var s;
  s = stack[stack.length - 1];
  if (s) {
    return s["#"] += text;
  }
};

({
  parseString: (str) => {
    return this.saxParser.write(str.toString());
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var old;

if (stack.length > 0) {
  if (!(nodeName in s)) {
    s[nodeName] = obj;
  } else if (s[nodeName] instanceof Array) {
    s[nodeName].push(obj);
  } else {
    old = s[nodeName];
    s[nodeName] = [old];
    s[nodeName].push(obj);
  }
} else {
  this.resultObject = obj;
  this.emit("end", this.resultObject);
}

this.saxParser.ontext = this.saxParser.oncdata = (text) => {
  var s;
  s = stack[stack.length - 1];
  if (s) {
    return s["#"] += text;
  }
};

({
  parseString: (str) => {
    return this.saxParser.write(str.toString());
  }
});
```

Response:
if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj
      else

Response:
@resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: ->
    # make the sax parser
    @saxParser = sax.parser(true)
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = false
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        # turn 2 or more spaces into one space
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj


Prompt:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: ->
    # make the sax parser
    @saxParser = sax.parser(true)
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = false
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if "@" not of obj
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>

Response:
obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        # turn 2 or more spaces into one space
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if nodeName not of s
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [old]
          s[nodeName].push obj


Response:
else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>
      s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (text) =>

Response:
s = stack[stack.length - 1]
      if s
        s["#"] += text

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: ->
    # make the sax parser
    @saxParser = sax.parser(true)
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = false
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if not ("@" of obj)
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>
      obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        # turn 2 or more spaces into one space
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if typeof s[nodeName] == "undefined"
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [ old ]
          s[nodeName].push obj


Prompt:
sax = require("sax")
events = require("events")

class exports.Parser extends events.EventEmitter
  constructor: ->
    # make the sax parser
    @saxParser = sax.parser(true)
    # always use the '#' key, even if there are no subkeys
    @EXPLICIT_CHARKEY = false
    @resultObject = null
    stack = []

    @saxParser.onopentag = (node) =>
      obj = {}
      obj["#"] = ""
      for own key of node.attributes
        if not ("@" of obj)
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]

      # need a place to store the node name
      obj["#name"] = node.name
      stack.push obj

    @saxParser.onclosetag = =>

Response:
obj = stack.pop()
      nodeName = obj["#name"]
      delete obj["#name"]

      s = stack[stack.length - 1]
      # remove the '#' key altogether if it's blank
      if obj["#"].match(/^\s*$/)
        delete obj["#"]
      else
        # turn 2 or more spaces into one space
        obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
        # also do away with '#' key altogether, if there's no subkeys
        # unless EXPLICIT_CHARKEY is set
        if Object.keys(obj).length == 1 and "#" of obj and not @EXPLICIT_CHARKEY
          obj = obj["#"]

      if stack.length > 0
        if typeof s[nodeName] == "undefined"
          s[nodeName] = obj
        else if s[nodeName] instanceof Array
          s[nodeName].push obj
        else
          old = s[nodeName]
          s[nodeName] = [ old ]
          s[nodeName].push obj


Response:
else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (t) ->
      s = stack[stack.length - 1]
      if s
        s["#"] += t

  parseString: (str) =>
    @saxParser.write str.toString()


Prompt:
else
        @resultObject = obj
        @emit "end", @resultObject

    @saxParser.ontext = @saxParser.oncdata = (t) ->

Response:
s = stack[stack.length - 1]
      if s
        s["#"] += t

  parseString: (str) =>
    @saxParser.write str.toString()


Response:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  # make the sax parser
  @saxParser = sax.parser(true)
  # always use the '#' key, even if there are no subkeys
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    # need a place to store the node name
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    # remove the '#' key altogether if it's blank
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      # turn 2 or more spaces into one space
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      # also do away with '#' key altogether, if there's no subkeys
      # unless EXPLICIT_CHARKEY is set
      if Object.keys(obj).length == 1 and "#" of obj and not that.EXPLICIT_CHARKEY
        obj = obj["#"]

    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  # make the sax parser
  @saxParser = sax.parser(true)
  # always use the '#' key, even if there are no subkeys
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    # need a place to store the node name
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    # remove the '#' key altogether if it's blank
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      # turn 2 or more spaces into one space
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      # also do away with '#' key altogether, if there's no subkeys
      # unless EXPLICIT_CHARKEY is set
      if Object.keys(obj).length == 1 and "#" of obj and not that.EXPLICIT_CHARKEY
        obj = obj["#"]

    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
```

Response:
var Parser, events, sax, sys,
  hasProp = {}.hasOwnProperty;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  // make the sax parser
  this.saxParser = sax.parser(true);
  // always use the '#' key, even if there are no subkeys
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj, ref;
    obj = {};
    obj["#"] = "";
    ref = node.attributes;
    for (key in ref) {
      if (!hasProp.call(ref, key)) continue;
      if (!("@" in obj)) {
        obj["@"] = {};
      }
      obj["@"][key] = node.attributes[key];
    }
    // need a place to store the node name
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  return this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    // remove the '#' key altogether if it's blank
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      // turn 2 or more spaces into one space
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      // also do away with '#' key altogether, if there's no subkeys
      // unless EXPLICIT_CHARKEY is set
      if (Object.keys(obj).length === 1 && "#" in obj && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    }
  };
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Parser, events, sax, sys,
  hasProp = {}.hasOwnProperty;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  // make the sax parser
  this.saxParser = sax.parser(true);
  // always use the '#' key, even if there are no subkeys
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj, ref;
    obj = {};
    obj["#"] = "";
    ref = node.attributes;
    for (key in ref) {
      if (!hasProp.call(ref, key)) continue;
      if (!("@" in obj)) {
        obj["@"] = {};
      }
      obj["@"][key] = node.attributes[key];
    }
    // need a place to store the node name
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  return this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    // remove the '#' key altogether if it's blank
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      // turn 2 or more spaces into one space
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      // also do away with '#' key altogether, if there's no subkeys
      // unless EXPLICIT_CHARKEY is set
      if (Object.keys(obj).length === 1 && "#" in obj && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    }
  };
};
```

Response:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  # make the sax parser
  @saxParser = sax.parser(true)
  # always use the '#' key, even if there are no subkeys
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    # need a place to store the node name
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    # remove the '#' key altogether if it's blank
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      # turn 2 or more spaces into one space
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      # also do away with '#' key altogether, if there's no subkeys
      # unless EXPLICIT_CHARKEY is set
      if Object.keys(obj).length == 1 and "#" of obj and not that.EXPLICIT_CHARKEY
        obj = obj["#"]

    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj


Prompt:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  # make the sax parser
  @saxParser = sax.parser(true)
  # always use the '#' key, even if there are no subkeys
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    # need a place to store the node name
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->

Response:
obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    # remove the '#' key altogether if it's blank
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      # turn 2 or more spaces into one space
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      # also do away with '#' key altogether, if there's no subkeys
      # unless EXPLICIT_CHARKEY is set
      if Object.keys(obj).length == 1 and "#" of obj and not that.EXPLICIT_CHARKEY
        obj = obj["#"]

    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj


Response:
else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t

  undefined

sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser


Prompt:
else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t

Response:
undefined

sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser


Response:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t
```

Response:
var Parser, events, sax, sys,
  hasProp = {}.hasOwnProperty,
  indexOf = [].indexOf;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  this.saxParser = sax.parser(true);
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj, ref;
    obj = {};
    obj["#"] = "";
    ref = node.attributes;
    for (key in ref) {
      if (!hasProp.call(ref, key)) continue;
      if (!("@" in obj)) {
        obj["@"] = {};
      }
      obj["@"][key] = node.attributes[key];
    }
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      if (Object.keys(obj).length === 1 && indexOf.call(obj, "#") >= 0 && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    } else {
      that.resultObject = obj;
      return that.emit("end", that.resultObject);
    }
  };
  return this.saxParser.ontext = this.saxParser.oncdata = function(t) {
    var s;
    s = stack[stack.length - 1];
    if (s) {
      return s["#"] += t;
    }
  };
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Parser, events, sax, sys,
  hasProp = {}.hasOwnProperty,
  indexOf = [].indexOf;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  this.saxParser = sax.parser(true);
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj, ref;
    obj = {};
    obj["#"] = "";
    ref = node.attributes;
    for (key in ref) {
      if (!hasProp.call(ref, key)) continue;
      if (!("@" in obj)) {
        obj["@"] = {};
      }
      obj["@"][key] = node.attributes[key];
    }
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      if (Object.keys(obj).length === 1 && indexOf.call(obj, "#") >= 0 && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    } else {
      that.resultObject = obj;
      return that.emit("end", that.resultObject);
    }
  };
  return this.saxParser.ontext = this.saxParser.oncdata = function(t) {
    var s;
    s = stack[stack.length - 1];
    if (s) {
      return s["#"] += t;
    }
  };
};
```

Response:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Prompt:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if not ("@" of obj)
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]

    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

Response:
s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Response:
undefined

sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
undefined

sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser
```

Response:
void 0;
sys.inherits(Parser, events.EventEmitter);

Parser.prototype.parseString = function(str) {
  return this.saxParser.write(str.toString());
};

exports.Parser = Parser;


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
void 0;
sys.inherits(Parser, events.EventEmitter);

Parser.prototype.parseString = function(str) {
  return this.saxParser.write(str.toString());
};

exports.Parser = Parser;
```

Response:
undefined

sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser


Prompt:
undefined

sys.inherits Parser, events.EventEmitter

Response:
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser


Response:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if typeof obj["@"] == "undefined"
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if typeof obj["@"] == "undefined"
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t
```

Response:
var Parser, events, sax, sys,
  hasProp = {}.hasOwnProperty,
  indexOf = [].indexOf;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  this.saxParser = sax.parser(true);
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj, ref;
    obj = {};
    obj["#"] = "";
    ref = node.attributes;
    for (key in ref) {
      if (!hasProp.call(ref, key)) continue;
      if (typeof obj["@"] === "undefined") {
        obj["@"] = {};
      }
      obj["@"][key] = node.attributes[key];
    }
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      if (Object.keys(obj).length === 1 && indexOf.call(obj, "#") >= 0 && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    } else {
      that.resultObject = obj;
      return that.emit("end", that.resultObject);
    }
  };
  return this.saxParser.ontext = this.saxParser.oncdata = function(t) {
    var s;
    s = stack[stack.length - 1];
    if (s) {
      return s["#"] += t;
    }
  };
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Parser, events, sax, sys,
  hasProp = {}.hasOwnProperty,
  indexOf = [].indexOf;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  this.saxParser = sax.parser(true);
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj, ref;
    obj = {};
    obj["#"] = "";
    ref = node.attributes;
    for (key in ref) {
      if (!hasProp.call(ref, key)) continue;
      if (typeof obj["@"] === "undefined") {
        obj["@"] = {};
      }
      obj["@"][key] = node.attributes[key];
    }
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      if (Object.keys(obj).length === 1 && indexOf.call(obj, "#") >= 0 && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    } else {
      that.resultObject = obj;
      return that.emit("end", that.resultObject);
    }
  };
  return this.saxParser.ontext = this.saxParser.oncdata = function(t) {
    var s;
    s = stack[stack.length - 1];
    if (s) {
      return s["#"] += t;
    }
  };
};
```

Response:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if typeof obj["@"] == "undefined"
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Prompt:
sax = require("sax")
sys = require("sys")
events = require("events")

Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for own key of node.attributes
      if typeof obj["@"] == "undefined"
        obj["@"] = {}
      obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

Response:
s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Response:
sax = require("sax")
sys = require("sys")
events = require("events")
Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for key of node.attributes
      if node.attributes.hasOwnProperty(key)
        if typeof obj["@"] == "undefined"
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
sax = require("sax")
sys = require("sys")
events = require("events")
Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for key of node.attributes
      if node.attributes.hasOwnProperty(key)
        if typeof obj["@"] == "undefined"
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t
```

Response:
var Parser, events, sax, sys,
  indexOf = [].indexOf;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  this.saxParser = sax.parser(true);
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj;
    obj = {};
    obj["#"] = "";
    for (key in node.attributes) {
      if (node.attributes.hasOwnProperty(key)) {
        if (typeof obj["@"] === "undefined") {
          obj["@"] = {};
        }
        obj["@"][key] = node.attributes[key];
      }
    }
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      if (Object.keys(obj).length === 1 && indexOf.call(obj, "#") >= 0 && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    } else {
      that.resultObject = obj;
      return that.emit("end", that.resultObject);
    }
  };
  return this.saxParser.ontext = this.saxParser.oncdata = function(t) {
    var s;
    s = stack[stack.length - 1];
    if (s) {
      return s["#"] += t;
    }
  };
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Parser, events, sax, sys,
  indexOf = [].indexOf;

sax = require("sax");

sys = require("sys");

events = require("events");

Parser = function() {
  var stack, that;
  that = this;
  this.saxParser = sax.parser(true);
  this.EXPLICIT_CHARKEY = false;
  this.resultObject = null;
  stack = [];
  this.saxParser.onopentag = function(node) {
    var key, obj;
    obj = {};
    obj["#"] = "";
    for (key in node.attributes) {
      if (node.attributes.hasOwnProperty(key)) {
        if (typeof obj["@"] === "undefined") {
          obj["@"] = {};
        }
        obj["@"][key] = node.attributes[key];
      }
    }
    obj["#name"] = node.name;
    return stack.push(obj);
  };
  this.saxParser.onclosetag = function() {
    var nodeName, obj, old, s;
    obj = stack.pop();
    nodeName = obj["#name"];
    delete obj["#name"];
    s = stack[stack.length - 1];
    if (obj["#"].match(/^\s*$/)) {
      delete obj["#"];
    } else {
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim();
      if (Object.keys(obj).length === 1 && indexOf.call(obj, "#") >= 0 && !that.EXPLICIT_CHARKEY) {
        obj = obj["#"];
      }
    }
    if (stack.length > 0) {
      if (typeof s[nodeName] === "undefined") {
        return s[nodeName] = obj;
      } else if (s[nodeName] instanceof Array) {
        return s[nodeName].push(obj);
      } else {
        old = s[nodeName];
        s[nodeName] = [old];
        return s[nodeName].push(obj);
      }
    } else {
      that.resultObject = obj;
      return that.emit("end", that.resultObject);
    }
  };
  return this.saxParser.ontext = this.saxParser.oncdata = function(t) {
    var s;
    s = stack[stack.length - 1];
    if (s) {
      return s["#"] += t;
    }
  };
};
```

Response:
sax = require("sax")
sys = require("sys")
events = require("events")
Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for key of node.attributes
      if node.attributes.hasOwnProperty(key)
        if typeof obj["@"] == "undefined"
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

    s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Prompt:
sax = require("sax")
sys = require("sys")
events = require("events")
Parser = ->
  that = this
  @saxParser = sax.parser(true)
  @EXPLICIT_CHARKEY = false
  @resultObject = null
  stack = []
  @saxParser.onopentag = (node) ->
    obj = {}
    obj["#"] = ""
    for key of node.attributes
      if node.attributes.hasOwnProperty(key)
        if typeof obj["@"] == "undefined"
          obj["@"] = {}
        obj["@"][key] = node.attributes[key]
    obj["#name"] = node.name
    stack.push obj

  @saxParser.onclosetag = ->
    obj = stack.pop()
    nodeName = obj["#name"]
    delete obj["#name"]

Response:
s = stack[stack.length - 1]
    if obj["#"].match(/^\s*$/)
      delete obj["#"]
    else
      obj["#"] = obj["#"].replace(/\s{2,}/g, " ").trim()
      if Object.keys(obj).length == 1 and "#" in obj and not (that.EXPLICIT_CHARKEY)
        obj = obj["#"]
    if stack.length > 0
      if typeof s[nodeName] == "undefined"
        s[nodeName] = obj
      else if s[nodeName] instanceof Array
        s[nodeName].push obj
      else
        old = s[nodeName]
        s[nodeName] = [ old ]
        s[nodeName].push obj
    else
      that.resultObject = obj
      that.emit "end", that.resultObject

  @saxParser.ontext = @saxParser.oncdata = (t) ->
    s = stack[stack.length - 1]
    if s
      s["#"] += t


Response:
sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser
```

Response:
sys.inherits(Parser, events.EventEmitter);

Parser.prototype.parseString = function(str) {
  return this.saxParser.write(str.toString());
};

exports.Parser = Parser;


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
sys.inherits(Parser, events.EventEmitter);

Parser.prototype.parseString = function(str) {
  return this.saxParser.write(str.toString());
};

exports.Parser = Parser;
```

Response:
sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->
  @saxParser.write str.toString()

exports.Parser = Parser


Prompt:
sys.inherits Parser, events.EventEmitter
Parser::parseString = (str) ->

Response:
@saxParser.write str.toString()

exports.Parser = Parser


Response:
{EventsDelegation} = require 'atom-utils'
CompositeDisposable = null

module.exports =
class StickyTitle
  EventsDelegation.includeInto(this)

  constructor: (@stickies, @scrollContainer) ->
    CompositeDisposable ?= require('atom').CompositeDisposable

    @subscriptions = new CompositeDisposable
    Array::forEach.call @stickies, (sticky) ->
      sticky.parentNode.style.height = sticky.offsetHeight + 'px'
      sticky.style.width = sticky.offsetWidth + 'px'

    @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>
      @scroll(e)

  dispose: ->
    @subscriptions.dispose()
    @stickies = null
    @scrollContainer = null

  scroll: (e) ->
    delta = if @lastScrollTop
      @lastScrollTop - @scrollContainer.scrollTop
    else
      0

    Array::forEach.call @stickies, (sticky, i) =>
      nextSticky = @stickies[i + 1]
      prevSticky = @stickies[i - 1]
      scrollTop = @scrollContainer.getBoundingClientRect().top
      parentTop = sticky.parentNode.getBoundingClientRect().top
      {top} = sticky.getBoundingClientRect()

      if parentTop < scrollTop
        unless sticky.classList.contains('absolute')
          sticky.classList.add 'fixed'
          sticky.style.top = scrollTop + 'px'

          if nextSticky?
            nextTop = nextSticky.parentNode.getBoundingClientRect().top
            if top + sticky.offsetHeight >= nextTop
              sticky.classList.add('absolute')
              sticky.style.top = @scrollContainer.scrollTop + 'px'

      else
        sticky.classList.remove 'fixed'


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
{EventsDelegation} = require 'atom-utils'
CompositeDisposable = null

module.exports =
class StickyTitle
  EventsDelegation.includeInto(this)

  constructor: (@stickies, @scrollContainer) ->
    CompositeDisposable ?= require('atom').CompositeDisposable

    @subscriptions = new CompositeDisposable
    Array::forEach.call @stickies, (sticky) ->
      sticky.parentNode.style.height = sticky.offsetHeight + 'px'
      sticky.style.width = sticky.offsetWidth + 'px'

    @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>
      @scroll(e)

  dispose: ->
    @subscriptions.dispose()
    @stickies = null
    @scrollContainer = null

  scroll: (e) ->
    delta = if @lastScrollTop
      @lastScrollTop - @scrollContainer.scrollTop
    else
      0

    Array::forEach.call @stickies, (sticky, i) =>
      nextSticky = @stickies[i + 1]
      prevSticky = @stickies[i - 1]
      scrollTop = @scrollContainer.getBoundingClientRect().top
      parentTop = sticky.parentNode.getBoundingClientRect().top
      {top} = sticky.getBoundingClientRect()

      if parentTop < scrollTop
        unless sticky.classList.contains('absolute')
          sticky.classList.add 'fixed'
          sticky.style.top = scrollTop + 'px'

          if nextSticky?
            nextTop = nextSticky.parentNode.getBoundingClientRect().top
            if top + sticky.offsetHeight >= nextTop
              sticky.classList.add('absolute')
              sticky.style.top = @scrollContainer.scrollTop + 'px'

      else
        sticky.classList.remove 'fixed'
```

Response:
var CompositeDisposable, EventsDelegation, StickyTitle;

({EventsDelegation} = require('atom-utils'));

CompositeDisposable = null;

module.exports = StickyTitle = (function() {
  class StickyTitle {
    constructor(stickies, scrollContainer) {
      this.stickies = stickies;
      this.scrollContainer = scrollContainer;
      if (CompositeDisposable == null) {
        CompositeDisposable = require('atom').CompositeDisposable;
      }
      this.subscriptions = new CompositeDisposable();
      Array.prototype.forEach.call(this.stickies, function(sticky) {
        sticky.parentNode.style.height = sticky.offsetHeight + 'px';
        return sticky.style.width = sticky.offsetWidth + 'px';
      });
      this.subscriptions.add(this.subscribeTo(this.scrollContainer, {
        'scroll': (e) => {
          return this.scroll(e);
        }
      }));
    }

    dispose() {
      this.subscriptions.dispose();
      this.stickies = null;
      return this.scrollContainer = null;
    }

    scroll(e) {
      var delta;
      delta = this.lastScrollTop ? this.lastScrollTop - this.scrollContainer.scrollTop : 0;
      return Array.prototype.forEach.call(this.stickies, (sticky, i) => {
        var nextSticky, nextTop, parentTop, prevSticky, scrollTop, top;
        nextSticky = this.stickies[i + 1];
        prevSticky = this.stickies[i - 1];
        scrollTop = this.scrollContainer.getBoundingClientRect().top;
        parentTop = sticky.parentNode.getBoundingClientRect().top;
        ({top} = sticky.getBoundingClientRect());
        if (parentTop < scrollTop) {
          if (!sticky.classList.contains('absolute')) {
            sticky.classList.add('fixed');
            sticky.style.top = scrollTop + 'px';
            if (nextSticky != null) {
              nextTop = nextSticky.parentNode.getBoundingClientRect().top;
              if (top + sticky.offsetHeight >= nextTop) {
                sticky.classList.add('absolute');
                return sticky.style.top = this.scrollContainer.scrollTop + 'px';
              }
            }
          }
        } else {
          return sticky.classList.remove('fixed');
        }
      });
    }

  };

  EventsDelegation.includeInto(StickyTitle);

  return StickyTitle;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var CompositeDisposable, EventsDelegation, StickyTitle;

({EventsDelegation} = require('atom-utils'));

CompositeDisposable = null;

module.exports = StickyTitle = (function() {
  class StickyTitle {
    constructor(stickies, scrollContainer) {
      this.stickies = stickies;
      this.scrollContainer = scrollContainer;
      if (CompositeDisposable == null) {
        CompositeDisposable = require('atom').CompositeDisposable;
      }
      this.subscriptions = new CompositeDisposable();
      Array.prototype.forEach.call(this.stickies, function(sticky) {
        sticky.parentNode.style.height = sticky.offsetHeight + 'px';
        return sticky.style.width = sticky.offsetWidth + 'px';
      });
      this.subscriptions.add(this.subscribeTo(this.scrollContainer, {
        'scroll': (e) => {
          return this.scroll(e);
        }
      }));
    }

    dispose() {
      this.subscriptions.dispose();
      this.stickies = null;
      return this.scrollContainer = null;
    }

    scroll(e) {
      var delta;
      delta = this.lastScrollTop ? this.lastScrollTop - this.scrollContainer.scrollTop : 0;
      return Array.prototype.forEach.call(this.stickies, (sticky, i) => {
        var nextSticky, nextTop, parentTop, prevSticky, scrollTop, top;
        nextSticky = this.stickies[i + 1];
        prevSticky = this.stickies[i - 1];
        scrollTop = this.scrollContainer.getBoundingClientRect().top;
        parentTop = sticky.parentNode.getBoundingClientRect().top;
        ({top} = sticky.getBoundingClientRect());
        if (parentTop < scrollTop) {
          if (!sticky.classList.contains('absolute')) {
            sticky.classList.add('fixed');
            sticky.style.top = scrollTop + 'px';
            if (nextSticky != null) {
              nextTop = nextSticky.parentNode.getBoundingClientRect().top;
              if (top + sticky.offsetHeight >= nextTop) {
                sticky.classList.add('absolute');
                return sticky.style.top = this.scrollContainer.scrollTop + 'px';
              }
            }
          }
        } else {
          return sticky.classList.remove('fixed');
        }
      });
    }

  };

  EventsDelegation.includeInto(StickyTitle);

  return StickyTitle;

}).call(this);
```

Response:
{EventsDelegation} = require 'atom-utils'
CompositeDisposable = null

module.exports =
class StickyTitle
  EventsDelegation.includeInto(this)

  constructor: (@stickies, @scrollContainer) ->
    CompositeDisposable ?= require('atom').CompositeDisposable

    @subscriptions = new CompositeDisposable
    Array::forEach.call @stickies, (sticky) ->
      sticky.parentNode.style.height = sticky.offsetHeight + 'px'
      sticky.style.width = sticky.offsetWidth + 'px'

    @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>
      @scroll(e)

  dispose: ->
    @subscriptions.dispose()
    @stickies = null
    @scrollContainer = null

  scroll: (e) ->
    delta = if @lastScrollTop
      @lastScrollTop - @scrollContainer.scrollTop
    else
      0

    Array::forEach.call @stickies, (sticky, i) =>
      nextSticky = @stickies[i + 1]
      prevSticky = @stickies[i - 1]
      scrollTop = @scrollContainer.getBoundingClientRect().top
      parentTop = sticky.parentNode.getBoundingClientRect().top
      {top} = sticky.getBoundingClientRect()

      if parentTop < scrollTop
        unless sticky.classList.contains('absolute')
          sticky.classList.add 'fixed'
          sticky.style.top = scrollTop + 'px'

          if nextSticky?
            nextTop = nextSticky.parentNode.getBoundingClientRect().top
            if top + sticky.offsetHeight >= nextTop
              sticky.classList.add('absolute')
              sticky.style.top = @scrollContainer.scrollTop + 'px'

      else
        sticky.classList.remove 'fixed'


Prompt:
{EventsDelegation} = require 'atom-utils'
CompositeDisposable = null

module.exports =
class StickyTitle
  EventsDelegation.includeInto(this)

  constructor: (@stickies, @scrollContainer) ->
    CompositeDisposable ?= require('atom').CompositeDisposable

    @subscriptions = new CompositeDisposable
    Array::forEach.call @stickies, (sticky) ->
      sticky.parentNode.style.height = sticky.offsetHeight + 'px'
      sticky.style.width = sticky.offsetWidth + 'px'

    @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>
      @scroll(e)

  dispose: ->
    @subscriptions.dispose()
    @stickies = null
    @scrollContainer = null

  scroll: (e) ->

Response:
delta = if @lastScrollTop
      @lastScrollTop - @scrollContainer.scrollTop
    else
      0

    Array::forEach.call @stickies, (sticky, i) =>
      nextSticky = @stickies[i + 1]
      prevSticky = @stickies[i - 1]
      scrollTop = @scrollContainer.getBoundingClientRect().top
      parentTop = sticky.parentNode.getBoundingClientRect().top
      {top} = sticky.getBoundingClientRect()

      if parentTop < scrollTop
        unless sticky.classList.contains('absolute')
          sticky.classList.add 'fixed'
          sticky.style.top = scrollTop + 'px'

          if nextSticky?
            nextTop = nextSticky.parentNode.getBoundingClientRect().top
            if top + sticky.offsetHeight >= nextTop
              sticky.classList.add('absolute')
              sticky.style.top = @scrollContainer.scrollTop + 'px'

      else
        sticky.classList.remove 'fixed'


Response:
if prevSticky? and prevSticky.classList.contains('absolute')
          prevTop = prevSticky.getBoundingClientRect().top
          prevTop -= prevSticky.offsetHeight if delta < 0

          if scrollTop <= prevTop
            prevSticky.classList.remove('absolute')
            prevSticky.style.top = scrollTop + 'px'

    @lastScrollTop = @scrollContainer.scrollTop


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
if prevSticky? and prevSticky.classList.contains('absolute')
          prevTop = prevSticky.getBoundingClientRect().top
          prevTop -= prevSticky.offsetHeight if delta < 0

          if scrollTop <= prevTop
            prevSticky.classList.remove('absolute')
            prevSticky.style.top = scrollTop + 'px'

    @lastScrollTop = @scrollContainer.scrollTop
```

Response:
var prevTop;

if ((typeof prevSticky !== "undefined" && prevSticky !== null) && prevSticky.classList.contains('absolute')) {
  prevTop = prevSticky.getBoundingClientRect().top;
  if (delta < 0) {
    prevTop -= prevSticky.offsetHeight;
  }
  if (scrollTop <= prevTop) {
    prevSticky.classList.remove('absolute');
    prevSticky.style.top = scrollTop + 'px';
  }
}

this.lastScrollTop = this.scrollContainer.scrollTop;


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var prevTop;

if ((typeof prevSticky !== "undefined" && prevSticky !== null) && prevSticky.classList.contains('absolute')) {
  prevTop = prevSticky.getBoundingClientRect().top;
  if (delta < 0) {
    prevTop -= prevSticky.offsetHeight;
  }
  if (scrollTop <= prevTop) {
    prevSticky.classList.remove('absolute');
    prevSticky.style.top = scrollTop + 'px';
  }
}

this.lastScrollTop = this.scrollContainer.scrollTop;
```

Response:
if prevSticky? and prevSticky.classList.contains('absolute')
          prevTop = prevSticky.getBoundingClientRect().top
          prevTop -= prevSticky.offsetHeight if delta < 0

          if scrollTop <= prevTop
            prevSticky.classList.remove('absolute')
            prevSticky.style.top = scrollTop + 'px'

    @lastScrollTop = @scrollContainer.scrollTop


Prompt:
if prevSticky? and prevSticky.classList.contains('absolute')
          prevTop = prevSticky.getBoundingClientRect().top
          prevTop -= prevSticky.offsetHeight if delta < 0

Response:
if scrollTop <= prevTop
            prevSticky.classList.remove('absolute')
            prevSticky.style.top = scrollTop + 'px'

    @lastScrollTop = @scrollContainer.scrollTop


Response:
{CompositeDisposable} = require 'atom'
{EventsDelegation} = require 'atom-utils'

module.exports =

class StickyTitle
  EventsDelegation.includeInto(this)

  constructor: (@stickies, @scrollContainer) ->
    @subscriptions = new CompositeDisposable
    Array::forEach.call @stickies, (sticky) ->
      sticky.parentNode.style.height = sticky.offsetHeight + 'px'
      sticky.style.width = sticky.offsetWidth + 'px'

    @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>
      @scroll(e)

  dispose: ->
    @subscriptions.dispose()
    @stickies = null
    @scrollContainer = null

  scroll: (e) ->
    delta = if @lastScrollTop
      @lastScrollTop - @scrollContainer.scrollTop
    else
      0

    Array::forEach.call @stickies, (sticky, i) =>
      nextSticky = @stickies[i + 1]
      prevSticky = @stickies[i - 1]
      scrollTop = @scrollContainer.getBoundingClientRect().top
      parentTop = sticky.parentNode.getBoundingClientRect().top
      {top} = sticky.getBoundingClientRect()

      if parentTop < scrollTop
        unless sticky.classList.contains('absolute')
          sticky.classList.add 'fixed'
          sticky.style.top = scrollTop + 'px'

          if nextSticky?
            nextTop = nextSticky.parentNode.getBoundingClientRect().top
            if top + sticky.offsetHeight >= nextTop
              sticky.classList.add('absolute')
              sticky.style.top = @scrollContainer.scrollTop + 'px'

      else
        sticky.classList.remove 'fixed'

        if prevSticky? and prevSticky.classList.contains('absolute')


Prompt:
{CompositeDisposable} = require 'atom'
{EventsDelegation} = require 'atom-utils'

module.exports =

class StickyTitle
  EventsDelegation.includeInto(this)

  constructor: (@stickies, @scrollContainer) ->
    @subscriptions = new CompositeDisposable
    Array::forEach.call @stickies, (sticky) ->
      sticky.parentNode.style.height = sticky.offsetHeight + 'px'
      sticky.style.width = sticky.offsetWidth + 'px'

    @subscriptions.add @subscribeTo @scrollContainer, 'scroll': (e) =>
      @scroll(e)

  dispose: ->
    @subscriptions.dispose()
    @stickies = null
    @scrollContainer = null

  scroll: (e) ->
    delta = if @lastScrollTop
      @lastScrollTop - @scrollContainer.scrollTop

Response:
else
      0

    Array::forEach.call @stickies, (sticky, i) =>
      nextSticky = @stickies[i + 1]
      prevSticky = @stickies[i - 1]
      scrollTop = @scrollContainer.getBoundingClientRect().top
      parentTop = sticky.parentNode.getBoundingClientRect().top
      {top} = sticky.getBoundingClientRect()

      if parentTop < scrollTop
        unless sticky.classList.contains('absolute')
          sticky.classList.add 'fixed'
          sticky.style.top = scrollTop + 'px'

          if nextSticky?
            nextTop = nextSticky.parentNode.getBoundingClientRect().top
            if top + sticky.offsetHeight >= nextTop
              sticky.classList.add('absolute')
              sticky.style.top = @scrollContainer.scrollTop + 'px'

      else
        sticky.classList.remove 'fixed'

        if prevSticky? and prevSticky.classList.contains('absolute')


Response:
prevTop = prevSticky.getBoundingClientRect().top
          prevTop -= prevSticky.offsetHeight if delta < 0

          if scrollTop <= prevTop
            prevSticky.classList.remove('absolute')
            prevSticky.style.top = scrollTop + 'px'

    @lastScrollTop = @scrollContainer.scrollTop


Prompt:
prevTop = prevSticky.getBoundingClientRect().top
          prevTop -= prevSticky.offsetHeight if delta < 0

          if scrollTop <= prevTop

Response:
prevSticky.classList.remove('absolute')
            prevSticky.style.top = scrollTop + 'px'

    @lastScrollTop = @scrollContainer.scrollTop


Response:
module.exports = React.createClass
  displayName: 'snippet-editor'
  mixins: [ PureRenderMixin ]

  propTypes:
    _toId: T.string
    _roomId: T.string
    _teamId: T.string
    _storyId: T.string
    draftMode: T.bool
    onClose: T.func.isRequired
    onSubmit: T.func.isRequired
    attachment: T.object

  getInitialState: ->
    data: Immutable.fromJS
      text: @props.attachment?.text or ''
      title: @props.attachment?.title or ''
      codeType: @props.attachment?.codeType or 'txt'

  componentDidMount: ->
    lazyModules.ensureCodeEditor =>
      isLoadedCodeEditor = true
      @debounceSaveDraft = debounce @saveDraft, 500
      @forceUpdate()

  componentWillUnmount: ->
    @debounceSaveDraft = null

  saveDraft: (snippetDraft) ->
    _channelId = @props._roomId or @props._toId or @props._storyId
    hasDraft = @state.data.get('text').length or @state.data.get('title').length

    if _channelId?
      if hasDraft
        draftActions.saveSnippet @props._teamId, _channelId, snippetDraft.toJS()
      else
        draftActions.clearSnippet @props._teamId, _channelId

  saveState: (data) ->
    @setState
      data: data
    , =>
      @debounceSaveDraft data

  handleEditorChange: (text) ->
    data = @state.data.set 'text', text
    @saveState data

  handleSelectorChange: (codeType) ->