Response:
module.exports = class ImageCache
  constructor: ->
    @_images = {}
    @_callbacksToRun = {}

  getSync: (url) ->
    @_images[url]  # will be undefined if url is not saved

  get: (url, callback) ->
    # Either the image is cached...
    if @_images[url]
      callback(@_images[url])

    # Or it is already being loaded...
    else if @_callbacksToRun[url]
      @_callbacksToRun[url].push(callback)

    # Or it's totally new...
    else
      @_callbacksToRun[url] = [callback]

      image = new Image()
      if not url.startsWith("data:")
        # (Safari doesn't like .crossOrigin when loading "data:" URLs)
        image.crossOrigin = "Anonymous"
      image.addEventListener "load", =>
        @_images[url] = image
        anyCallback(image) for anyCallback in @_callbacksToRun[url]
        delete @_callbacksToRun[url]
      image.src = url


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class ImageCache
  constructor: ->
    @_images = {}
    @_callbacksToRun = {}

  getSync: (url) ->
    @_images[url]  # will be undefined if url is not saved

  get: (url, callback) ->
    # Either the image is cached...
    if @_images[url]
      callback(@_images[url])

    # Or it is already being loaded...
    else if @_callbacksToRun[url]
      @_callbacksToRun[url].push(callback)

    # Or it's totally new...
    else
      @_callbacksToRun[url] = [callback]

      image = new Image()
      if not url.startsWith("data:")
        # (Safari doesn't like .crossOrigin when loading "data:" URLs)
        image.crossOrigin = "Anonymous"
      image.addEventListener "load", =>
        @_images[url] = image
        anyCallback(image) for anyCallback in @_callbacksToRun[url]
        delete @_callbacksToRun[url]
      image.src = url
```

Response:
var ImageCache;

module.exports = ImageCache = class ImageCache {
  constructor() {
    this._images = {};
    this._callbacksToRun = {};
  }

  getSync(url) {
    return this._images[url];
  }

  get(url, callback) {
    var image;
    // Either the image is cached...
    if (this._images[url]) {
      return callback(this._images[url]);
    // Or it is already being loaded...
    } else if (this._callbacksToRun[url]) {
      return this._callbacksToRun[url].push(callback);
    } else {
      // Or it's totally new...
      this._callbacksToRun[url] = [callback];
      image = new Image();
      if (!url.startsWith("data:")) {
        // (Safari doesn't like .crossOrigin when loading "data:" URLs)
        image.crossOrigin = "Anonymous";
      }
      image.addEventListener("load", () => {
        var anyCallback, i, len, ref;
        this._images[url] = image;
        ref = this._callbacksToRun[url];
        for (i = 0, len = ref.length; i < len; i++) {
          anyCallback = ref[i];
          anyCallback(image);
        }
        return delete this._callbacksToRun[url];
      });
      return image.src = url;
    }
  }

};


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

module.exports = ImageCache = class ImageCache {
  constructor() {
    this._images = {};
    this._callbacksToRun = {};
  }

  getSync(url) {
    return this._images[url];
  }

  get(url, callback) {
    var image;
    // Either the image is cached...
    if (this._images[url]) {
      return callback(this._images[url]);
    // Or it is already being loaded...
    } else if (this._callbacksToRun[url]) {
      return this._callbacksToRun[url].push(callback);
    } else {
      // Or it's totally new...
      this._callbacksToRun[url] = [callback];
      image = new Image();
      if (!url.startsWith("data:")) {
        // (Safari doesn't like .crossOrigin when loading "data:" URLs)
        image.crossOrigin = "Anonymous";
      }
      image.addEventListener("load", () => {
        var anyCallback, i, len, ref;
        this._images[url] = image;
        ref = this._callbacksToRun[url];
        for (i = 0, len = ref.length; i < len; i++) {
          anyCallback = ref[i];
          anyCallback(image);
        }
        return delete this._callbacksToRun[url];
      });
      return image.src = url;
    }
  }

};
```

Response:
module.exports = class ImageCache
  constructor: ->
    @_images = {}
    @_callbacksToRun = {}

  getSync: (url) ->
    @_images[url]  # will be undefined if url is not saved

  get: (url, callback) ->
    # Either the image is cached...
    if @_images[url]
      callback(@_images[url])

    # Or it is already being loaded...
    else if @_callbacksToRun[url]
      @_callbacksToRun[url].push(callback)

    # Or it's totally new...
    else
      @_callbacksToRun[url] = [callback]

      image = new Image()
      if not url.startsWith("data:")
        # (Safari doesn't like .crossOrigin when loading "data:" URLs)
        image.crossOrigin = "Anonymous"
      image.addEventListener "load", =>
        @_images[url] = image
        anyCallback(image) for anyCallback in @_callbacksToRun[url]
        delete @_callbacksToRun[url]
      image.src = url


Prompt:
module.exports = class ImageCache
  constructor: ->
    @_images = {}
    @_callbacksToRun = {}

  getSync: (url) ->
    @_images[url]  # will be undefined if url is not saved

  get: (url, callback) ->
    # Either the image is cached...
    if @_images[url]
      callback(@_images[url])

    # Or it is already being loaded...
    else if @_callbacksToRun[url]

Response:
@_callbacksToRun[url].push(callback)

    # Or it's totally new...
    else
      @_callbacksToRun[url] = [callback]

      image = new Image()
      if not url.startsWith("data:")
        # (Safari doesn't like .crossOrigin when loading "data:" URLs)
        image.crossOrigin = "Anonymous"
      image.addEventListener "load", =>
        @_images[url] = image
        anyCallback(image) for anyCallback in @_callbacksToRun[url]
        delete @_callbacksToRun[url]
      image.src = url


Response:
_            = require 'lodash'
TestDatabase = require '../test-database'

describe 'getDevice', ->
  beforeEach (done) ->
    @sut = require '../../lib/getDevice'
    TestDatabase.open (error, database) =>
      @database = database
      done error

  describe 'when a device does not exist', ->
    beforeEach (done) ->
      storeDevice = (@error, @device) => done()
      @sut 'does-not-exist', storeDevice, @database

    it 'should not have a device', ->
      expect(@device).to.not.exist

    it 'should have an error', ->
      expect(@error).to.exist

  describe 'when a device exists', ->
    beforeEach (done) ->
      @devices = @database.devices
      @devices.insert uuid: 'valid-uuid', token: 'some-token', done

    describe 'when passed a valid uuid', ->
      beforeEach (done) ->
        storeDevice = (@error, @device) => done()
        @sut 'valid-uuid', storeDevice, @database

      it 'should have a device', ->
        expect(@device).to.exist

      it 'should not have an error', ->
        expect(@error).to.not.exist

      it 'should not have a token', ->
        expect(@device.token).to.not.exist


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
_            = require 'lodash'
TestDatabase = require '../test-database'

describe 'getDevice', ->
  beforeEach (done) ->
    @sut = require '../../lib/getDevice'
    TestDatabase.open (error, database) =>
      @database = database
      done error

  describe 'when a device does not exist', ->
    beforeEach (done) ->
      storeDevice = (@error, @device) => done()
      @sut 'does-not-exist', storeDevice, @database

    it 'should not have a device', ->
      expect(@device).to.not.exist

    it 'should have an error', ->
      expect(@error).to.exist

  describe 'when a device exists', ->
    beforeEach (done) ->
      @devices = @database.devices
      @devices.insert uuid: 'valid-uuid', token: 'some-token', done

    describe 'when passed a valid uuid', ->
      beforeEach (done) ->
        storeDevice = (@error, @device) => done()
        @sut 'valid-uuid', storeDevice, @database

      it 'should have a device', ->
        expect(@device).to.exist

      it 'should not have an error', ->
        expect(@error).to.not.exist

      it 'should not have a token', ->
        expect(@device.token).to.not.exist
```

Response:
var TestDatabase, _;

_ = require('lodash');

TestDatabase = require('../test-database');

describe('getDevice', function() {
  beforeEach(function(done) {
    this.sut = require('../../lib/getDevice');
    return TestDatabase.open((error, database) => {
      this.database = database;
      return done(error);
    });
  });
  describe('when a device does not exist', function() {
    beforeEach(function(done) {
      var storeDevice;
      storeDevice = (error1, device) => {
        this.error = error1;
        this.device = device;
        return done();
      };
      return this.sut('does-not-exist', storeDevice, this.database);
    });
    it('should not have a device', function() {
      return expect(this.device).to.not.exist;
    });
    return it('should have an error', function() {
      return expect(this.error).to.exist;
    });
  });
  return describe('when a device exists', function() {
    beforeEach(function(done) {
      this.devices = this.database.devices;
      return this.devices.insert({
        uuid: 'valid-uuid',
        token: 'some-token'
      }, done);
    });
    return describe('when passed a valid uuid', function() {
      beforeEach(function(done) {
        var storeDevice;
        storeDevice = (error1, device) => {
          this.error = error1;
          this.device = device;
          return done();
        };
        return this.sut('valid-uuid', storeDevice, this.database);
      });
      it('should have a device', function() {
        return expect(this.device).to.exist;
      });
      it('should not have an error', function() {
        return expect(this.error).to.not.exist;
      });
      return it('should not have a token', function() {
        return expect(this.device.token).to.not.exist;
      });
    });
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var TestDatabase, _;

_ = require('lodash');

TestDatabase = require('../test-database');

describe('getDevice', function() {
  beforeEach(function(done) {
    this.sut = require('../../lib/getDevice');
    return TestDatabase.open((error, database) => {
      this.database = database;
      return done(error);
    });
  });
  describe('when a device does not exist', function() {
    beforeEach(function(done) {
      var storeDevice;
      storeDevice = (error1, device) => {
        this.error = error1;
        this.device = device;
        return done();
      };
      return this.sut('does-not-exist', storeDevice, this.database);
    });
    it('should not have a device', function() {
      return expect(this.device).to.not.exist;
    });
    return it('should have an error', function() {
      return expect(this.error).to.exist;
    });
  });
  return describe('when a device exists', function() {
    beforeEach(function(done) {
      this.devices = this.database.devices;
      return this.devices.insert({
        uuid: 'valid-uuid',
        token: 'some-token'
      }, done);
    });
    return describe('when passed a valid uuid', function() {
      beforeEach(function(done) {
        var storeDevice;
        storeDevice = (error1, device) => {
          this.error = error1;
          this.device = device;
          return done();
        };
        return this.sut('valid-uuid', storeDevice, this.database);
      });
      it('should have a device', function() {
        return expect(this.device).to.exist;
      });
      it('should not have an error', function() {
        return expect(this.error).to.not.exist;
      });
      return it('should not have a token', function() {
        return expect(this.device.token).to.not.exist;
      });
    });
  });
});
```

Response:
_            = require 'lodash'
TestDatabase = require '../test-database'

describe 'getDevice', ->
  beforeEach (done) ->
    @sut = require '../../lib/getDevice'
    TestDatabase.open (error, database) =>
      @database = database
      done error

  describe 'when a device does not exist', ->
    beforeEach (done) ->
      storeDevice = (@error, @device) => done()
      @sut 'does-not-exist', storeDevice, @database

    it 'should not have a device', ->
      expect(@device).to.not.exist

    it 'should have an error', ->
      expect(@error).to.exist

  describe 'when a device exists', ->
    beforeEach (done) ->
      @devices = @database.devices
      @devices.insert uuid: 'valid-uuid', token: 'some-token', done

    describe 'when passed a valid uuid', ->
      beforeEach (done) ->
        storeDevice = (@error, @device) => done()
        @sut 'valid-uuid', storeDevice, @database

      it 'should have a device', ->
        expect(@device).to.exist

      it 'should not have an error', ->
        expect(@error).to.not.exist

      it 'should not have a token', ->
        expect(@device.token).to.not.exist


Prompt:
_            = require 'lodash'
TestDatabase = require '../test-database'

describe 'getDevice', ->
  beforeEach (done) ->
    @sut = require '../../lib/getDevice'
    TestDatabase.open (error, database) =>
      @database = database
      done error

  describe 'when a device does not exist', ->
    beforeEach (done) ->
      storeDevice = (@error, @device) => done()
      @sut 'does-not-exist', storeDevice, @database

    it 'should not have a device', ->
      expect(@device).to.not.exist

    it 'should have an error', ->

Response:
expect(@error).to.exist

  describe 'when a device exists', ->
    beforeEach (done) ->
      @devices = @database.devices
      @devices.insert uuid: 'valid-uuid', token: 'some-token', done

    describe 'when passed a valid uuid', ->
      beforeEach (done) ->
        storeDevice = (@error, @device) => done()
        @sut 'valid-uuid', storeDevice, @database

      it 'should have a device', ->
        expect(@device).to.exist

      it 'should not have an error', ->
        expect(@error).to.not.exist

      it 'should not have a token', ->
        expect(@device.token).to.not.exist


Response:
on_stdin = (req,res,params)->
  value = params.value.trim()
  log.info 'stdin value',value
  process.emit 'data', value
  res.endjson()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
on_stdin = (req,res,params)->
  value = params.value.trim()
  log.info 'stdin value',value
  process.emit 'data', value
  res.endjson()
```

Response:
var on_stdin;

on_stdin = function(req, res, params) {
  var value;
  value = params.value.trim();
  log.info('stdin value', value);
  process.emit('data', value);
  return res.endjson();
};


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

on_stdin = function(req, res, params) {
  var value;
  value = params.value.trim();
  log.info('stdin value', value);
  process.emit('data', value);
  return res.endjson();
};
```

Response:
on_stdin = (req,res,params)->
  value = params.value.trim()
  log.info 'stdin value',value
  process.emit 'data', value
  res.endjson()


Prompt:
on_stdin = (req,res,params)->
  value = params.value.trim()

Response:
log.info 'stdin value',value
  process.emit 'data', value
  res.endjson()


Response:
on_sendmsg = (req,res,params)->
  log.info "will send #{params.type} #{params.to} : #{params.msg}"
  if params.type == 'buddy'
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}
  else if params.type == 'group'
      cb_sendmessage params.to, params.msg, res
  else
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
on_sendmsg = (req,res,params)->
  log.info "will send #{params.type} #{params.to} : #{params.msg}"
  if params.type == 'buddy'
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}
  else if params.type == 'group'
      cb_sendmessage params.to, params.msg, res
  else
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}
```

Response:
var on_sendmsg;

on_sendmsg = function(req, res, params) {
  var msg;
  log.info(`will send ${params.type} ${params.to} : ${params.msg}`);
  if (params.type === 'buddy') {
    msg = `unimplement type ${params.type}`;
    log.warning(msg);
    return res.endjson({
      err: 100,
      msg: msg
    });
  } else if (params.type === 'group') {
    return cb_sendmessage(params.to, params.msg, res);
  } else {
    msg = `unimplement type ${params.type}`;
    log.warning(msg);
    return res.endjson({
      err: 100,
      msg: msg
    });
  }
};


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

on_sendmsg = function(req, res, params) {
  var msg;
  log.info(`will send ${params.type} ${params.to} : ${params.msg}`);
  if (params.type === 'buddy') {
    msg = `unimplement type ${params.type}`;
    log.warning(msg);
    return res.endjson({
      err: 100,
      msg: msg
    });
  } else if (params.type === 'group') {
    return cb_sendmessage(params.to, params.msg, res);
  } else {
    msg = `unimplement type ${params.type}`;
    log.warning(msg);
    return res.endjson({
      err: 100,
      msg: msg
    });
  }
};
```

Response:
on_sendmsg = (req,res,params)->
  log.info "will send #{params.type} #{params.to} : #{params.msg}"
  if params.type == 'buddy'
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}
  else if params.type == 'group'
      cb_sendmessage params.to, params.msg, res
  else
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}


Prompt:
on_sendmsg = (req,res,params)->
  log.info "will send #{params.type} #{params.to} : #{params.msg}"
  if params.type == 'buddy'
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}

Response:
else if params.type == 'group'
      cb_sendmessage params.to, params.msg, res
  else
    msg =  "unimplement type #{params.type}"
    log.warning msg
    res.endjson {err:100,msg:msg}


Response:
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200
    res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)
    when '/reload'then on_reload_plugin(req,res,params)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200
    res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)
    when '/reload'then on_reload_plugin(req,res,params)
```

Response:
var handle_request;

handle_request = function(req, res, path, params) {
  res.endjson = function(dict = {}) {
    var key, ret_dict, value;
    ret_dict = {
      err: 0,
      msg: 'ok'
    };
    for (key in dict) {
      value = dict[key];
      ret_dict[key] = value;
    }
    res.writeHead(200);
    return res.end(jsons(ret_dict));
  };
  if (config_token && params.token !== config_token) {
    res.endjson({
      err: 503,
      msg: 'token failed'
    });
    return;
  }
  switch (path) {
    case '/stdin':
      return on_stdin(req, res, params);
    case '/send':
      return on_sendmsg(req, res, params);
    case '/reload':
      return on_reload_plugin(req, res, params);
  }
};


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

handle_request = function(req, res, path, params) {
  res.endjson = function(dict = {}) {
    var key, ret_dict, value;
    ret_dict = {
      err: 0,
      msg: 'ok'
    };
    for (key in dict) {
      value = dict[key];
      ret_dict[key] = value;
    }
    res.writeHead(200);
    return res.end(jsons(ret_dict));
  };
  if (config_token && params.token !== config_token) {
    res.endjson({
      err: 503,
      msg: 'token failed'
    });
    return;
  }
  switch (path) {
    case '/stdin':
      return on_stdin(req, res, params);
    case '/send':
      return on_sendmsg(req, res, params);
    case '/reload':
      return on_reload_plugin(req, res, params);
  }
};
```

Response:
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200
    res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)
    when '/reload'then on_reload_plugin(req,res,params)


Prompt:
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200

Response:
res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)
    when '/reload'then on_reload_plugin(req,res,params)


Response:
create_server = (port)->
  server = http.createServer (req, res) ->
    log.debug '[api]' , req.url
    url = URL.parse req.url
    path = url.pathname
    if req.method == 'POST'
      processPost req, res, (body)->
        handle_request(req, res, path, body)
    else if req.method == 'GET'
      query = querystring.parse url.query
      handle_request(req, res, path, query)

  server.listen port
  log.info 'api server started at port',port


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
create_server = (port)->
  server = http.createServer (req, res) ->
    log.debug '[api]' , req.url
    url = URL.parse req.url
    path = url.pathname
    if req.method == 'POST'
      processPost req, res, (body)->
        handle_request(req, res, path, body)
    else if req.method == 'GET'
      query = querystring.parse url.query
      handle_request(req, res, path, query)

  server.listen port
  log.info 'api server started at port',port
```

Response:
var create_server;

create_server = function(port) {
  var server;
  server = http.createServer(function(req, res) {
    var path, query, url;
    log.debug('[api]', req.url);
    url = URL.parse(req.url);
    path = url.pathname;
    if (req.method === 'POST') {
      return processPost(req, res, function(body) {
        return handle_request(req, res, path, body);
      });
    } else if (req.method === 'GET') {
      query = querystring.parse(url.query);
      return handle_request(req, res, path, query);
    }
  });
  server.listen(port);
  return log.info('api server started at port', port);
};


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

create_server = function(port) {
  var server;
  server = http.createServer(function(req, res) {
    var path, query, url;
    log.debug('[api]', req.url);
    url = URL.parse(req.url);
    path = url.pathname;
    if (req.method === 'POST') {
      return processPost(req, res, function(body) {
        return handle_request(req, res, path, body);
      });
    } else if (req.method === 'GET') {
      query = querystring.parse(url.query);
      return handle_request(req, res, path, query);
    }
  });
  server.listen(port);
  return log.info('api server started at port', port);
};
```

Response:
create_server = (port)->
  server = http.createServer (req, res) ->
    log.debug '[api]' , req.url
    url = URL.parse req.url
    path = url.pathname
    if req.method == 'POST'
      processPost req, res, (body)->
        handle_request(req, res, path, body)
    else if req.method == 'GET'
      query = querystring.parse url.query
      handle_request(req, res, path, query)

  server.listen port
  log.info 'api server started at port',port


Prompt:
create_server = (port)->
  server = http.createServer (req, res) ->
    log.debug '[api]' , req.url
    url = URL.parse req.url
    path = url.pathname
    if req.method == 'POST'
      processPost req, res, (body)->

Response:
handle_request(req, res, path, body)
    else if req.method == 'GET'
      query = querystring.parse url.query
      handle_request(req, res, path, query)

  server.listen port
  log.info 'api server started at port',port


Response:
exports.run = (port,token)->
  config_port  = port or 3000
  config_token = token
  create_server config_port


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
exports.run = (port,token)->
  config_port  = port or 3000
  config_token = token
  create_server config_port
```

Response:
exports.run = function(port, token) {
  var config_port, config_token;
  config_port = port || 3000;
  config_token = token;
  return create_server(config_port);
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
exports.run = function(port, token) {
  var config_port, config_token;
  config_port = port || 3000;
  config_token = token;
  return create_server(config_port);
};
```

Response:
exports.run = (port,token)->
  config_port  = port or 3000
  config_token = token
  create_server config_port


Prompt:
exports.run = (port,token)->
  config_port  = port or 3000

Response:
config_token = token
  create_server config_port


Response:
exports.stop = ->
  server.close() if server
  server = null

# @callback group_name, message, res
# need call res.endjson {} to finish request


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
exports.stop = ->
  server.close() if server
  server = null

# @callback group_name, message, res
# need call res.endjson {} to finish request
```

Response:
exports.stop = function() {
  var server;
  if (server) {
    server.close();
  }
  return server = null;
};

// @callback group_name, message, res
// need call res.endjson {} to finish request


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
exports.stop = function() {
  var server;
  if (server) {
    server.close();
  }
  return server = null;
};

// @callback group_name, message, res
// need call res.endjson {} to finish request
```

Response:
exports.stop = ->
  server.close() if server
  server = null

# @callback group_name, message, res
# need call res.endjson {} to finish request


Response:
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200
    res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200
    res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)
```

Response:
var handle_request;

handle_request = function(req, res, path, params) {
  res.endjson = function(dict = {}) {
    var key, ret_dict, value;
    ret_dict = {
      err: 0,
      msg: 'ok'
    };
    for (key in dict) {
      value = dict[key];
      ret_dict[key] = value;
    }
    res.writeHead(200);
    return res.end(jsons(ret_dict));
  };
  if (config_token && params.token !== config_token) {
    res.endjson({
      err: 503,
      msg: 'token failed'
    });
    return;
  }
  switch (path) {
    case '/stdin':
      return on_stdin(req, res, params);
    case '/send':
      return on_sendmsg(req, res, params);
  }
};


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

handle_request = function(req, res, path, params) {
  res.endjson = function(dict = {}) {
    var key, ret_dict, value;
    ret_dict = {
      err: 0,
      msg: 'ok'
    };
    for (key in dict) {
      value = dict[key];
      ret_dict[key] = value;
    }
    res.writeHead(200);
    return res.end(jsons(ret_dict));
  };
  if (config_token && params.token !== config_token) {
    res.endjson({
      err: 503,
      msg: 'token failed'
    });
    return;
  }
  switch (path) {
    case '/stdin':
      return on_stdin(req, res, params);
    case '/send':
      return on_sendmsg(req, res, params);
  }
};
```

Response:
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200
    res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)


Prompt:
handle_request = (req,res,path,params)->
  res.endjson = (dict={})->
    ret_dict =
      err: 0
      msg: 'ok'
    for key,value of dict
      ret_dict[key] = value

    res.writeHead 200

Response:
res.end jsons ret_dict

  if config_token and params.token isnt config_token
    res.endjson {err:503,msg:'token failed'}
    return

  switch path
    when '/stdin' then on_stdin(req,res,params)
    when '/send'  then on_sendmsg(req,res,params)


Response:
# Known formulas

class Dimensions

  right: (scope) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]

  bottom: (scope, path) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]

  center:
    x: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]

    y: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]

module.exports = Dimensions


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# Known formulas

class Dimensions

  right: (scope) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]

  bottom: (scope, path) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]

  center:
    x: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]

    y: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]

module.exports = Dimensions
```

Response:
// Known formulas
var Dimensions;

Dimensions = (function() {
  class Dimensions {
    right(scope) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'x')], ['get', this.getPath(id, 'width')]];
    }

    bottom(scope, path) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'y')], ['get', this.getPath(id, 'height')]];
    }

  };

  Dimensions.prototype.center = {
    x: function(scope, path) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'x')], ['/', ['get', this.getPath(id, 'width')], 2]];
    },
    y: function(scope, path) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'y')], ['/', ['get', this.getPath(id, 'height')], 2]];
    }
  };

  return Dimensions;

}).call(this);

module.exports = Dimensions;


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// Known formulas
var Dimensions;

Dimensions = (function() {
  class Dimensions {
    right(scope) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'x')], ['get', this.getPath(id, 'width')]];
    }

    bottom(scope, path) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'y')], ['get', this.getPath(id, 'height')]];
    }

  };

  Dimensions.prototype.center = {
    x: function(scope, path) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'x')], ['/', ['get', this.getPath(id, 'width')], 2]];
    },
    y: function(scope, path) {
      var id;
      id = this.identify(scope);
      return ['+', ['get', this.getPath(id, 'y')], ['/', ['get', this.getPath(id, 'height')], 2]];
    }
  };

  return Dimensions;

}).call(this);

module.exports = Dimensions;
```

Response:
# Known formulas

class Dimensions

  right: (scope) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]

  bottom: (scope, path) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]

  center:
    x: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]

    y: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]

module.exports = Dimensions


Prompt:
# Known formulas

class Dimensions

  right: (scope) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'x')], ['get', @getPath(id, 'width')]]

  bottom: (scope, path) ->
    id = @identify(scope)
    return ['+', ['get', @getPath(id, 'y')], ['get', @getPath(id, 'height')]]

Response:
center:
    x: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'x')], ['/', ['get', @getPath(id, 'width')], 2]]

    y: (scope, path) ->
      id = @identify(scope)
      return ['+', ['get', @getPath(id, 'y')], ['/', ['get', @getPath(id, 'height')], 2]]

module.exports = Dimensions


Response:
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

      left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return# element.offsetHeight

    width: (element) ->
      return# element.offsetWidth


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

      left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return# element.offsetHeight

    width: (element) ->
      return# element.offsetWidth
```

Response:
var Dimensions;

Dimensions = (function() {
  class Dimensions {};

  // Global variables managed by the engine
  Dimensions.prototype['::window'] = {
    width: function() {
      return window.innerWidth;
    },
    height: function() {
      return window.innerHeight;
    },
    //right: '::window[width]'
    //bottom: '::window[height]'

    //center:
    //  x: ->
    //    return window.innerWidth / 2

    //  y: ->
    //    return window.innerHeight / 2
    scroll: {
      left: function() {
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
      },
      top: function() {
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      }
    },
    x: 0,
    y: 0
  };

  Dimensions.prototype['::document'] = {
    scroll: {
      left: '::window[scroll-left]',
      top: '::window[scroll-top]'
    },
    x: '::window[x]',
    y: '::window[y]'
  };

  Dimensions.prototype.intrinsic = {
    height: function(element) {}, // element.offsetHeight
    width: function(element) {} // element.offsetWidth
  };

  return Dimensions;

}).call(this);


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

Dimensions = (function() {
  class Dimensions {};

  // Global variables managed by the engine
  Dimensions.prototype['::window'] = {
    width: function() {
      return window.innerWidth;
    },
    height: function() {
      return window.innerHeight;
    },
    //right: '::window[width]'
    //bottom: '::window[height]'

    //center:
    //  x: ->
    //    return window.innerWidth / 2

    //  y: ->
    //    return window.innerHeight / 2
    scroll: {
      left: function() {
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
      },
      top: function() {
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      }
    },
    x: 0,
    y: 0
  };

  Dimensions.prototype['::document'] = {
    scroll: {
      left: '::window[scroll-left]',
      top: '::window[scroll-top]'
    },
    x: '::window[x]',
    y: '::window[y]'
  };

  Dimensions.prototype.intrinsic = {
    height: function(element) {}, // element.offsetHeight
    width: function(element) {} // element.offsetWidth
  };

  return Dimensions;

}).call(this);
```

Response:
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

      left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return# element.offsetHeight

    width: (element) ->
      return# element.offsetWidth


Prompt:
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

Response:
left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return# element.offsetHeight

    width: (element) ->
      return# element.offsetWidth


Response:
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

      left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return element.offsetHeight

    width: (element) ->
      return element.offsetWidth


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

      left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return element.offsetHeight

    width: (element) ->
      return element.offsetWidth
```

Response:
var Dimensions;

Dimensions = (function() {
  class Dimensions {};

  // Global variables managed by the engine
  Dimensions.prototype['::window'] = {
    width: function() {
      return window.innerWidth;
    },
    height: function() {
      return window.innerHeight;
    },
    //right: '::window[width]'
    //bottom: '::window[height]'

    //center:
    //  x: ->
    //    return window.innerWidth / 2

    //  y: ->
    //    return window.innerHeight / 2
    scroll: {
      left: function() {
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
      },
      top: function() {
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      }
    },
    x: 0,
    y: 0
  };

  Dimensions.prototype['::document'] = {
    scroll: {
      left: '::window[scroll-left]',
      top: '::window[scroll-top]'
    },
    x: '::window[x]',
    y: '::window[y]'
  };

  Dimensions.prototype.intrinsic = {
    height: function(element) {
      return element.offsetHeight;
    },
    width: function(element) {
      return element.offsetWidth;
    }
  };

  return Dimensions;

}).call(this);


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

Dimensions = (function() {
  class Dimensions {};

  // Global variables managed by the engine
  Dimensions.prototype['::window'] = {
    width: function() {
      return window.innerWidth;
    },
    height: function() {
      return window.innerHeight;
    },
    //right: '::window[width]'
    //bottom: '::window[height]'

    //center:
    //  x: ->
    //    return window.innerWidth / 2

    //  y: ->
    //    return window.innerHeight / 2
    scroll: {
      left: function() {
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft;
      },
      top: function() {
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      }
    },
    x: 0,
    y: 0
  };

  Dimensions.prototype['::document'] = {
    scroll: {
      left: '::window[scroll-left]',
      top: '::window[scroll-top]'
    },
    x: '::window[x]',
    y: '::window[y]'
  };

  Dimensions.prototype.intrinsic = {
    height: function(element) {
      return element.offsetHeight;
    },
    width: function(element) {
      return element.offsetWidth;
    }
  };

  return Dimensions;

}).call(this);
```

Response:
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

      left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return element.offsetHeight

    width: (element) ->
      return element.offsetWidth


Prompt:
class Dimensions
  # Global variables managed by the engine

  '::window':

    width: ->
      return window.innerWidth

    height: ->
      return window.innerHeight

    #right: '::window[width]'
    #bottom: '::window[height]'
    #
    #center:
    #  x: ->
    #    return window.innerWidth / 2
    #
    #  y: ->
    #    return window.innerHeight / 2

    scroll:

Response:
left: ->
        return window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft

      top: ->
        return window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop

    x: 0
    y: 0

  '::document':

    scroll:
      left: '::window[scroll-left]'
      top:  '::window[scroll-top]'

    x: '::window[x]'
    y: '::window[y]'

  intrinsic:

    height: (element) ->
      return element.offsetHeight

    width: (element) ->
      return element.offsetWidth


Response:
suite 'Test toString() function with built-in XML writer:', ->
  test 'Nodes', ->
    eq xml('root').doc().toString(), '<?xml version="1.0"?><root/>'
    eq xml('root').toString(), '<root/>'
    eq xml('root').att('att', 'val').attribs['att'].toString(), ' att="val"'
    eq xml('root').dat('val').children[0].toString(), '<![CDATA[val]]>'
    eq xml('root').com('val').children[0].toString(), '<!-- val -->'
    eq xml('root').ins('target', 'val').children[0].toString(), '<?target val?>'
    eq xml('root').raw('val').children[0].toString(), 'val'
    eq xml('root').text('val').children[0].toString(), 'val'

  test 'DTD', ->
    eq(
      xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()
      '<!DOCTYPE root PUBLIC "pub" "sys">'
    )
    eq(
      xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', "yes").children[0].toString()
      '<!ATTLIST img visible (yes|no) "yes">'
    )
    eq(
      xml('root').dtd().ele('img', 'EMPTY').children[0].toString()
      '<!ELEMENT img EMPTY>'
    )
    eq(
      xml('root').dtd().ent('ent', 'my val').children[0].toString()
      '<!ENTITY ent "my val">'
    )
    eq(
      xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()
      '<!NOTATION fs SYSTEM "http://my.fs.com/reader">'
    )

  test 'XML Declaration', ->
    eq(
      xml('root').dec().doc().children[0].toString()
      '<?xml version="1.0"?>'
    )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Test toString() function with built-in XML writer:', ->
  test 'Nodes', ->
    eq xml('root').doc().toString(), '<?xml version="1.0"?><root/>'
    eq xml('root').toString(), '<root/>'
    eq xml('root').att('att', 'val').attribs['att'].toString(), ' att="val"'
    eq xml('root').dat('val').children[0].toString(), '<![CDATA[val]]>'
    eq xml('root').com('val').children[0].toString(), '<!-- val -->'
    eq xml('root').ins('target', 'val').children[0].toString(), '<?target val?>'
    eq xml('root').raw('val').children[0].toString(), 'val'
    eq xml('root').text('val').children[0].toString(), 'val'

  test 'DTD', ->
    eq(
      xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()
      '<!DOCTYPE root PUBLIC "pub" "sys">'
    )
    eq(
      xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', "yes").children[0].toString()
      '<!ATTLIST img visible (yes|no) "yes">'
    )
    eq(
      xml('root').dtd().ele('img', 'EMPTY').children[0].toString()
      '<!ELEMENT img EMPTY>'
    )
    eq(
      xml('root').dtd().ent('ent', 'my val').children[0].toString()
      '<!ENTITY ent "my val">'
    )
    eq(
      xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()
      '<!NOTATION fs SYSTEM "http://my.fs.com/reader">'
    )

  test 'XML Declaration', ->
    eq(
      xml('root').dec().doc().children[0].toString()
      '<?xml version="1.0"?>'
    )
```

Response:
suite('Test toString() function with built-in XML writer:', function() {
  test('Nodes', function() {
    eq(xml('root').doc().toString(), '<?xml version="1.0"?><root/>');
    eq(xml('root').toString(), '<root/>');
    eq(xml('root').att('att', 'val').attribs['att'].toString(), ' att="val"');
    eq(xml('root').dat('val').children[0].toString(), '<![CDATA[val]]>');
    eq(xml('root').com('val').children[0].toString(), '<!-- val -->');
    eq(xml('root').ins('target', 'val').children[0].toString(), '<?target val?>');
    eq(xml('root').raw('val').children[0].toString(), 'val');
    return eq(xml('root').text('val').children[0].toString(), 'val');
  });
  test('DTD', function() {
    eq(xml('root').dtd({
      pubID: 'pub',
      sysID: 'sys'
    }).toString(), '<!DOCTYPE root PUBLIC "pub" "sys">');
    eq(xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', "yes").children[0].toString(), '<!ATTLIST img visible (yes|no) "yes">');
    eq(xml('root').dtd().ele('img', 'EMPTY').children[0].toString(), '<!ELEMENT img EMPTY>');
    eq(xml('root').dtd().ent('ent', 'my val').children[0].toString(), '<!ENTITY ent "my val">');
    return eq(xml('root').dtd().not('fs', {
      sysID: 'http://my.fs.com/reader'
    }).children[0].toString(), '<!NOTATION fs SYSTEM "http://my.fs.com/reader">');
  });
  return test('XML Declaration', function() {
    return eq(xml('root').dec().doc().children[0].toString(), '<?xml version="1.0"?>');
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
suite('Test toString() function with built-in XML writer:', function() {
  test('Nodes', function() {
    eq(xml('root').doc().toString(), '<?xml version="1.0"?><root/>');
    eq(xml('root').toString(), '<root/>');
    eq(xml('root').att('att', 'val').attribs['att'].toString(), ' att="val"');
    eq(xml('root').dat('val').children[0].toString(), '<![CDATA[val]]>');
    eq(xml('root').com('val').children[0].toString(), '<!-- val -->');
    eq(xml('root').ins('target', 'val').children[0].toString(), '<?target val?>');
    eq(xml('root').raw('val').children[0].toString(), 'val');
    return eq(xml('root').text('val').children[0].toString(), 'val');
  });
  test('DTD', function() {
    eq(xml('root').dtd({
      pubID: 'pub',
      sysID: 'sys'
    }).toString(), '<!DOCTYPE root PUBLIC "pub" "sys">');
    eq(xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', "yes").children[0].toString(), '<!ATTLIST img visible (yes|no) "yes">');
    eq(xml('root').dtd().ele('img', 'EMPTY').children[0].toString(), '<!ELEMENT img EMPTY>');
    eq(xml('root').dtd().ent('ent', 'my val').children[0].toString(), '<!ENTITY ent "my val">');
    return eq(xml('root').dtd().not('fs', {
      sysID: 'http://my.fs.com/reader'
    }).children[0].toString(), '<!NOTATION fs SYSTEM "http://my.fs.com/reader">');
  });
  return test('XML Declaration', function() {
    return eq(xml('root').dec().doc().children[0].toString(), '<?xml version="1.0"?>');
  });
});
```

Response:
suite 'Test toString() function with built-in XML writer:', ->
  test 'Nodes', ->
    eq xml('root').doc().toString(), '<?xml version="1.0"?><root/>'
    eq xml('root').toString(), '<root/>'
    eq xml('root').att('att', 'val').attribs['att'].toString(), ' att="val"'
    eq xml('root').dat('val').children[0].toString(), '<![CDATA[val]]>'
    eq xml('root').com('val').children[0].toString(), '<!-- val -->'
    eq xml('root').ins('target', 'val').children[0].toString(), '<?target val?>'
    eq xml('root').raw('val').children[0].toString(), 'val'
    eq xml('root').text('val').children[0].toString(), 'val'

  test 'DTD', ->
    eq(
      xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()
      '<!DOCTYPE root PUBLIC "pub" "sys">'
    )
    eq(
      xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', "yes").children[0].toString()
      '<!ATTLIST img visible (yes|no) "yes">'
    )
    eq(
      xml('root').dtd().ele('img', 'EMPTY').children[0].toString()
      '<!ELEMENT img EMPTY>'
    )
    eq(
      xml('root').dtd().ent('ent', 'my val').children[0].toString()
      '<!ENTITY ent "my val">'
    )
    eq(
      xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()
      '<!NOTATION fs SYSTEM "http://my.fs.com/reader">'
    )

  test 'XML Declaration', ->
    eq(
      xml('root').dec().doc().children[0].toString()
      '<?xml version="1.0"?>'
    )


Prompt:
suite 'Test toString() function with built-in XML writer:', ->
  test 'Nodes', ->
    eq xml('root').doc().toString(), '<?xml version="1.0"?><root/>'
    eq xml('root').toString(), '<root/>'
    eq xml('root').att('att', 'val').attribs['att'].toString(), ' att="val"'
    eq xml('root').dat('val').children[0].toString(), '<![CDATA[val]]>'
    eq xml('root').com('val').children[0].toString(), '<!-- val -->'
    eq xml('root').ins('target', 'val').children[0].toString(), '<?target val?>'
    eq xml('root').raw('val').children[0].toString(), 'val'
    eq xml('root').text('val').children[0].toString(), 'val'

  test 'DTD', ->
    eq(
      xml('root').dtd({pubID: 'pub', sysID: 'sys'}).toString()
      '<!DOCTYPE root PUBLIC "pub" "sys">'
    )
    eq(
      xml('root').dtd().att('img', 'visible', '(yes|no)', '#DEFAULT', "yes").children[0].toString()
      '<!ATTLIST img visible (yes|no) "yes">'

Response:
)
    eq(
      xml('root').dtd().ele('img', 'EMPTY').children[0].toString()
      '<!ELEMENT img EMPTY>'
    )
    eq(
      xml('root').dtd().ent('ent', 'my val').children[0].toString()
      '<!ENTITY ent "my val">'
    )
    eq(
      xml('root').dtd().not('fs', { sysID: 'http://my.fs.com/reader' }).children[0].toString()
      '<!NOTATION fs SYSTEM "http://my.fs.com/reader">'
    )

  test 'XML Declaration', ->
    eq(
      xml('root').dec().doc().children[0].toString()
      '<?xml version="1.0"?>'
    )


Response:
root = exports ? this

root.Houston ?= {}

Houston._collections ?= {}

Houston._collections.collections = new Meteor.Collection('houston_collections')

Houston._admins = new Meteor.Collection('houston_admins')

Houston._user_is_admin = (id) ->
  return id? and Houston._admins.findOne user_id: id


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
root = exports ? this

root.Houston ?= {}

Houston._collections ?= {}

Houston._collections.collections = new Meteor.Collection('houston_collections')

Houston._admins = new Meteor.Collection('houston_admins')

Houston._user_is_admin = (id) ->
  return id? and Houston._admins.findOne user_id: id
```

Response:
var root;

root = typeof exports !== "undefined" && exports !== null ? exports : this;

if (root.Houston == null) {
  root.Houston = {};
}

if (Houston._collections == null) {
  Houston._collections = {};
}

Houston._collections.collections = new Meteor.Collection('houston_collections');

Houston._admins = new Meteor.Collection('houston_admins');

Houston._user_is_admin = function(id) {
  return (id != null) && Houston._admins.findOne({
    user_id: id
  });
};


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

root = typeof exports !== "undefined" && exports !== null ? exports : this;

if (root.Houston == null) {
  root.Houston = {};
}

if (Houston._collections == null) {
  Houston._collections = {};
}

Houston._collections.collections = new Meteor.Collection('houston_collections');

Houston._admins = new Meteor.Collection('houston_admins');

Houston._user_is_admin = function(id) {
  return (id != null) && Houston._admins.findOne({
    user_id: id
  });
};
```

Response:
root = exports ? this

root.Houston ?= {}

Houston._collections ?= {}

Houston._collections.collections = new Meteor.Collection('houston_collections')

Houston._admins = new Meteor.Collection('houston_admins')

Houston._user_is_admin = (id) ->
  return id? and Houston._admins.findOne user_id: id


Prompt:
root = exports ? this

root.Houston ?= {}

Houston._collections ?= {}

Response:
Houston._collections.collections = new Meteor.Collection('houston_collections')

Houston._admins = new Meteor.Collection('houston_admins')

Houston._user_is_admin = (id) ->
  return id? and Houston._admins.findOne user_id: id


Response:
###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }
```

Response:
/*
 * Copyright (c) 2013-2018 the original author or authors.
 *
 * Licensed under the MIT License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.opensource.org/licenses/mit-license.php
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 */
cyclotronDirectives.directive('propertyTable', function() {
  return {
    restrict: 'EAC',
    scope: {
      properties: '='
    },
    templateUrl: 'partials/help/propertyTable.html',
    link: function(scope, element, attrs) {}
  };
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
/*
 * Copyright (c) 2013-2018 the original author or authors.
 *
 * Licensed under the MIT License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.opensource.org/licenses/mit-license.php
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 */
cyclotronDirectives.directive('propertyTable', function() {
  return {
    restrict: 'EAC',
    scope: {
      properties: '='
    },
    templateUrl: 'partials/help/propertyTable.html',
    link: function(scope, element, attrs) {}
  };
});
```

Response:
###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }


Prompt:
###
# Copyright (c) 2013-2018 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific

Response:
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }


Response:
###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }
```

Response:
/*
 * Copyright (c) 2013-2015 the original author or authors.
 *
 * Licensed under the MIT License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.opensource.org/licenses/mit-license.php
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 */
cyclotronDirectives.directive('propertyTable', function() {
  return {
    restrict: 'EAC',
    scope: {
      properties: '='
    },
    templateUrl: 'partials/help/propertyTable.html',
    link: function(scope, element, attrs) {}
  };
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
/*
 * Copyright (c) 2013-2015 the original author or authors.
 *
 * Licensed under the MIT License (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.opensource.org/licenses/mit-license.php
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific
 * language governing permissions and limitations under the License.
 */
cyclotronDirectives.directive('propertyTable', function() {
  return {
    restrict: 'EAC',
    scope: {
      properties: '='
    },
    templateUrl: 'partials/help/propertyTable.html',
    link: function(scope, element, attrs) {}
  };
});
```

Response:
###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }


Prompt:
###
# Copyright (c) 2013-2015 the original author or authors.
#
# Licensed under the MIT License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.opensource.org/licenses/mit-license.php
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific

Response:
# language governing permissions and limitations under the License.
###

cyclotronDirectives.directive 'propertyTable', ->
    {
        restrict: 'EAC'
        scope:
            properties: '='
        templateUrl: 'partials/help/propertyTable.html'

        link: (scope, element, attrs) ->
            return
    }


Response:
util = require '../src/util'

module.exports =

  'getNames':

    'no names': (test) ->
      test.deepEqual [], util.getNames '/foo/bar/baz'
      test.done()

    'one name': (test) ->
      test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'
      test.done()

    'three names': (test) ->
      test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'
      test.done()

    'names with prefix wildcard': (test) ->
      test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'
      test.done()

    'names with infix wildcard': (test) ->
      test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'
      test.done()

    'names with postfix wildcard': (test) ->
      test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'
      test.done()

    'name _ is disallowed': (test) ->
      test.throws ->
        util.getNames '/foo/:_'
      test.done()

    'duplicate pattern names are disallowed': (test) ->
      test.throws ->
        util.getNames '/:foo/:foo'
      test.done()

  'toRegexString':

    '^ and $ are added': (test) ->
      test.equals '^foo$', util.toRegexString 'foo'
      test.done()

    '/ are escaped': (test) ->
      test.equals '^/foo$', util.toRegexString '/foo'
      test.done()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
util = require '../src/util'

module.exports =

  'getNames':

    'no names': (test) ->
      test.deepEqual [], util.getNames '/foo/bar/baz'
      test.done()

    'one name': (test) ->
      test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'
      test.done()

    'three names': (test) ->
      test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'
      test.done()

    'names with prefix wildcard': (test) ->
      test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'
      test.done()

    'names with infix wildcard': (test) ->
      test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'
      test.done()

    'names with postfix wildcard': (test) ->
      test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'
      test.done()

    'name _ is disallowed': (test) ->
      test.throws ->
        util.getNames '/foo/:_'
      test.done()

    'duplicate pattern names are disallowed': (test) ->
      test.throws ->
        util.getNames '/:foo/:foo'
      test.done()

  'toRegexString':

    '^ and $ are added': (test) ->
      test.equals '^foo$', util.toRegexString 'foo'
      test.done()

    '/ are escaped': (test) ->
      test.equals '^/foo$', util.toRegexString '/foo'
      test.done()
```

Response:
var util;

util = require('../src/util');

module.exports = {
  'getNames': {
    'no names': function(test) {
      test.deepEqual([], util.getNames('/foo/bar/baz'));
      return test.done();
    },
    'one name': function(test) {
      test.deepEqual(['foo'], util.getNames('/foo/:foo/bar/baz'));
      return test.done();
    },
    'three names': function(test) {
      test.deepEqual(['foo', 'bar', 'baz'], util.getNames('/foo/:foo/bar/:bar/baz/:baz'));
      return test.done();
    },
    'names with prefix wildcard': function(test) {
      test.deepEqual(['_', 'bar', 'baz'], util.getNames('/foo/*/bar/:bar/baz/:baz'));
      return test.done();
    },
    'names with infix wildcard': function(test) {
      test.deepEqual(['foo', '_', 'baz'], util.getNames('/foo/:foo/bar/*/baz/:baz'));
      return test.done();
    },
    'names with postfix wildcard': function(test) {
      test.deepEqual(['foo', 'bar', '_'], util.getNames('/foo/:foo/bar/:bar/baz/*'));
      return test.done();
    },
    'name _ is disallowed': function(test) {
      test.throws(function() {
        return util.getNames('/foo/:_');
      });
      return test.done();
    },
    'duplicate pattern names are disallowed': function(test) {
      test.throws(function() {
        return util.getNames('/:foo/:foo');
      });
      return test.done();
    }
  },
  'toRegexString': {
    '^ and $ are added': function(test) {
      test.equals('^foo$', util.toRegexString('foo'));
      return test.done();
    },
    '/ are escaped': function(test) {
      test.equals('^/foo$', util.toRegexString('/foo'));
      return test.done();
    }
  }
};


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

util = require('../src/util');

module.exports = {
  'getNames': {
    'no names': function(test) {
      test.deepEqual([], util.getNames('/foo/bar/baz'));
      return test.done();
    },
    'one name': function(test) {
      test.deepEqual(['foo'], util.getNames('/foo/:foo/bar/baz'));
      return test.done();
    },
    'three names': function(test) {
      test.deepEqual(['foo', 'bar', 'baz'], util.getNames('/foo/:foo/bar/:bar/baz/:baz'));
      return test.done();
    },
    'names with prefix wildcard': function(test) {
      test.deepEqual(['_', 'bar', 'baz'], util.getNames('/foo/*/bar/:bar/baz/:baz'));
      return test.done();
    },
    'names with infix wildcard': function(test) {
      test.deepEqual(['foo', '_', 'baz'], util.getNames('/foo/:foo/bar/*/baz/:baz'));
      return test.done();
    },
    'names with postfix wildcard': function(test) {
      test.deepEqual(['foo', 'bar', '_'], util.getNames('/foo/:foo/bar/:bar/baz/*'));
      return test.done();
    },
    'name _ is disallowed': function(test) {
      test.throws(function() {
        return util.getNames('/foo/:_');
      });
      return test.done();
    },
    'duplicate pattern names are disallowed': function(test) {
      test.throws(function() {
        return util.getNames('/:foo/:foo');
      });
      return test.done();
    }
  },
  'toRegexString': {
    '^ and $ are added': function(test) {
      test.equals('^foo$', util.toRegexString('foo'));
      return test.done();
    },
    '/ are escaped': function(test) {
      test.equals('^/foo$', util.toRegexString('/foo'));
      return test.done();
    }
  }
};
```

Response:
util = require '../src/util'

module.exports =

  'getNames':

    'no names': (test) ->
      test.deepEqual [], util.getNames '/foo/bar/baz'
      test.done()

    'one name': (test) ->
      test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'
      test.done()

    'three names': (test) ->
      test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'
      test.done()

    'names with prefix wildcard': (test) ->
      test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'
      test.done()

    'names with infix wildcard': (test) ->
      test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'
      test.done()

    'names with postfix wildcard': (test) ->
      test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'
      test.done()

    'name _ is disallowed': (test) ->
      test.throws ->
        util.getNames '/foo/:_'
      test.done()

    'duplicate pattern names are disallowed': (test) ->
      test.throws ->
        util.getNames '/:foo/:foo'
      test.done()

  'toRegexString':

    '^ and $ are added': (test) ->
      test.equals '^foo$', util.toRegexString 'foo'
      test.done()

    '/ are escaped': (test) ->
      test.equals '^/foo$', util.toRegexString '/foo'
      test.done()


Prompt:
util = require '../src/util'

module.exports =

  'getNames':

    'no names': (test) ->
      test.deepEqual [], util.getNames '/foo/bar/baz'
      test.done()

    'one name': (test) ->
      test.deepEqual ['foo'], util.getNames '/foo/:foo/bar/baz'
      test.done()

    'three names': (test) ->
      test.deepEqual ['foo', 'bar', 'baz'], util.getNames '/foo/:foo/bar/:bar/baz/:baz'
      test.done()

    'names with prefix wildcard': (test) ->
      test.deepEqual ['_', 'bar', 'baz'], util.getNames '/foo/*/bar/:bar/baz/:baz'
      test.done()

    'names with infix wildcard': (test) ->
      test.deepEqual ['foo', '_', 'baz'], util.getNames '/foo/:foo/bar/*/baz/:baz'

Response:
test.done()

    'names with postfix wildcard': (test) ->
      test.deepEqual ['foo', 'bar', '_'], util.getNames '/foo/:foo/bar/:bar/baz/*'
      test.done()

    'name _ is disallowed': (test) ->
      test.throws ->
        util.getNames '/foo/:_'
      test.done()

    'duplicate pattern names are disallowed': (test) ->
      test.throws ->
        util.getNames '/:foo/:foo'
      test.done()

  'toRegexString':

    '^ and $ are added': (test) ->
      test.equals '^foo$', util.toRegexString 'foo'
      test.done()

    '/ are escaped': (test) ->
      test.equals '^/foo$', util.toRegexString '/foo'
      test.done()


Response:
'names are replaced': (test) ->
      test.equals '^/users/([^/]+)/tasks/([^/]+)$',
          util.toRegexString '/users/:userId/tasks/:taskId'
      test.done()

    'wildcards are replaced': (test) ->
      test.equals '^(.*)foo$', util.toRegexString '*foo'
      test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'
      test.done()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
'names are replaced': (test) ->
      test.equals '^/users/([^/]+)/tasks/([^/]+)$',
          util.toRegexString '/users/:userId/tasks/:taskId'
      test.done()

    'wildcards are replaced': (test) ->
      test.equals '^(.*)foo$', util.toRegexString '*foo'
      test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'
      test.done()
```

Response:
({
  'names are replaced': function(test) {
    test.equals('^/users/([^/]+)/tasks/([^/]+)$', util.toRegexString('/users/:userId/tasks/:taskId'));
    return test.done();
  },
  'wildcards are replaced': function(test) {
    test.equals('^(.*)foo$', util.toRegexString('*foo'));
    test.equals('^(.*)foo(.*)$', util.toRegexString('*foo*'));
    return test.done();
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  'names are replaced': function(test) {
    test.equals('^/users/([^/]+)/tasks/([^/]+)$', util.toRegexString('/users/:userId/tasks/:taskId'));
    return test.done();
  },
  'wildcards are replaced': function(test) {
    test.equals('^(.*)foo$', util.toRegexString('*foo'));
    test.equals('^(.*)foo(.*)$', util.toRegexString('*foo*'));
    return test.done();
  }
});
```

Response:
'names are replaced': (test) ->
      test.equals '^/users/([^/]+)/tasks/([^/]+)$',
          util.toRegexString '/users/:userId/tasks/:taskId'
      test.done()

    'wildcards are replaced': (test) ->
      test.equals '^(.*)foo$', util.toRegexString '*foo'
      test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'
      test.done()


Prompt:
'names are replaced': (test) ->
      test.equals '^/users/([^/]+)/tasks/([^/]+)$',
          util.toRegexString '/users/:userId/tasks/:taskId'
      test.done()

Response:
'wildcards are replaced': (test) ->
      test.equals '^(.*)foo$', util.toRegexString '*foo'
      test.equals '^(.*)foo(.*)$', util.toRegexString '*foo*'
      test.done()


Response:
appendSearchNode = (node$) ->
  searchableNodes.push [node$.text().toLowerCase(), node$]

currentQuery = ''


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
appendSearchNode = (node$) ->
  searchableNodes.push [node$.text().toLowerCase(), node$]

currentQuery = ''
```

Response:
var appendSearchNode, currentQuery;

appendSearchNode = function(node$) {
  return searchableNodes.push([node$.text().toLowerCase(), node$]);
};

currentQuery = '';


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var appendSearchNode, currentQuery;

appendSearchNode = function(node$) {
  return searchableNodes.push([node$.text().toLowerCase(), node$]);
};

currentQuery = '';
```

Response:
appendSearchNode = (node$) ->
  searchableNodes.push [node$.text().toLowerCase(), node$]

currentQuery = ''


Response:
searchNodes = (queryString) ->
  queryString = queryString.toLowerCase().replace(/\s+/, '')
  return if queryString == currentQuery
  currentQuery = queryString

  return clearFilter() if queryString == ''

  matcher  = new RegExp (c.replace /[-[\]{}()*+?.,\\^$|#\s]/, "\\$&" for c in queryString).join '.*'
  matched  = []
  filtered = []

  for nodeInfo in searchableNodes
    if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]

  return clearFilter() if matched.length > MAX_FILTER_SIZE

  # Update the DOM
  for node$ in filtered
    node$.removeClass 'matched-child'
    node$.addClass 'filtered'

  for node$ in matched
    node$.removeClass 'filtered matched-child'

    highlightMatch node$, queryString

    # Filter out our immediate parent
    $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
searchNodes = (queryString) ->
  queryString = queryString.toLowerCase().replace(/\s+/, '')
  return if queryString == currentQuery
  currentQuery = queryString

  return clearFilter() if queryString == ''

  matcher  = new RegExp (c.replace /[-[\]{}()*+?.,\\^$|#\s]/, "\\$&" for c in queryString).join '.*'
  matched  = []
  filtered = []

  for nodeInfo in searchableNodes
    if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]

  return clearFilter() if matched.length > MAX_FILTER_SIZE

  # Update the DOM
  for node$ in filtered
    node$.removeClass 'matched-child'
    node$.addClass 'filtered'

  for node$ in matched
    node$.removeClass 'filtered matched-child'

    highlightMatch node$, queryString

    # Filter out our immediate parent
    $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'
```

Response:
var searchNodes;

searchNodes = function(queryString) {
  var c, currentQuery, filtered, i, j, k, len, len1, len2, matched, matcher, node$, nodeInfo, p, results;
  queryString = queryString.toLowerCase().replace(/\s+/, '');
  if (queryString === currentQuery) {
    return;
  }
  currentQuery = queryString;
  if (queryString === '') {
    return clearFilter();
  }
  matcher = new RegExp(((function() {
    var i, len, results;
    results = [];
    for (i = 0, len = queryString.length; i < len; i++) {
      c = queryString[i];
      results.push(c.replace(/[-[\]{}()*+?.,\\^$|#\s]/, "\\$&"));
    }
    return results;
  })()).join('.*'));
  matched = [];
  filtered = [];
  for (i = 0, len = searchableNodes.length; i < len; i++) {
    nodeInfo = searchableNodes[i];
    if (matcher.test(nodeInfo[0])) {
      matched.push(nodeInfo[1]);
    } else {
      filtered.push(nodeInfo[1]);
    }
  }
  if (matched.length > MAX_FILTER_SIZE) {
    return clearFilter();
  }
// Update the DOM
  for (j = 0, len1 = filtered.length; j < len1; j++) {
    node$ = filtered[j];
    node$.removeClass('matched-child');
    node$.addClass('filtered');
  }
  results = [];
  for (k = 0, len2 = matched.length; k < len2; k++) {
    node$ = matched[k];
    node$.removeClass('filtered matched-child');
    highlightMatch(node$, queryString);
    results.push((function() {
      var l, len3, ref, results1;
      ref = node$.parent().parents('li');
      results1 = [];
      for (l = 0, len3 = ref.length; l < len3; l++) {
        p = ref[l];
        // Filter out our immediate parent
        results1.push($(p).find('> a').addClass('matched-child'));
      }
      return results1;
    })());
  }
  return results;
};


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

searchNodes = function(queryString) {
  var c, currentQuery, filtered, i, j, k, len, len1, len2, matched, matcher, node$, nodeInfo, p, results;
  queryString = queryString.toLowerCase().replace(/\s+/, '');
  if (queryString === currentQuery) {
    return;
  }
  currentQuery = queryString;
  if (queryString === '') {
    return clearFilter();
  }
  matcher = new RegExp(((function() {
    var i, len, results;
    results = [];
    for (i = 0, len = queryString.length; i < len; i++) {
      c = queryString[i];
      results.push(c.replace(/[-[\]{}()*+?.,\\^$|#\s]/, "\\$&"));
    }
    return results;
  })()).join('.*'));
  matched = [];
  filtered = [];
  for (i = 0, len = searchableNodes.length; i < len; i++) {
    nodeInfo = searchableNodes[i];
    if (matcher.test(nodeInfo[0])) {
      matched.push(nodeInfo[1]);
    } else {
      filtered.push(nodeInfo[1]);
    }
  }
  if (matched.length > MAX_FILTER_SIZE) {
    return clearFilter();
  }
// Update the DOM
  for (j = 0, len1 = filtered.length; j < len1; j++) {
    node$ = filtered[j];
    node$.removeClass('matched-child');
    node$.addClass('filtered');
  }
  results = [];
  for (k = 0, len2 = matched.length; k < len2; k++) {
    node$ = matched[k];
    node$.removeClass('filtered matched-child');
    highlightMatch(node$, queryString);
    results.push((function() {
      var l, len3, ref, results1;
      ref = node$.parent().parents('li');
      results1 = [];
      for (l = 0, len3 = ref.length; l < len3; l++) {
        p = ref[l];
        // Filter out our immediate parent
        results1.push($(p).find('> a').addClass('matched-child'));
      }
      return results1;
    })());
  }
  return results;
};
```

Response:
searchNodes = (queryString) ->
  queryString = queryString.toLowerCase().replace(/\s+/, '')
  return if queryString == currentQuery
  currentQuery = queryString

  return clearFilter() if queryString == ''

  matcher  = new RegExp (c.replace /[-[\]{}()*+?.,\\^$|#\s]/, "\\$&" for c in queryString).join '.*'
  matched  = []
  filtered = []

  for nodeInfo in searchableNodes
    if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]

  return clearFilter() if matched.length > MAX_FILTER_SIZE

  # Update the DOM
  for node$ in filtered
    node$.removeClass 'matched-child'
    node$.addClass 'filtered'

  for node$ in matched
    node$.removeClass 'filtered matched-child'

    highlightMatch node$, queryString

    # Filter out our immediate parent
    $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'


Prompt:
searchNodes = (queryString) ->
  queryString = queryString.toLowerCase().replace(/\s+/, '')
  return if queryString == currentQuery
  currentQuery = queryString

  return clearFilter() if queryString == ''

  matcher  = new RegExp (c.replace /[-[\]{}()*+?.,\\^$|#\s]/, "\\$&" for c in queryString).join '.*'
  matched  = []
  filtered = []

  for nodeInfo in searchableNodes
    if matcher.test nodeInfo[0] then matched.push nodeInfo[1] else filtered.push nodeInfo[1]

Response:
return clearFilter() if matched.length > MAX_FILTER_SIZE

  # Update the DOM
  for node$ in filtered
    node$.removeClass 'matched-child'
    node$.addClass 'filtered'

  for node$ in matched
    node$.removeClass 'filtered matched-child'

    highlightMatch node$, queryString

    # Filter out our immediate parent
    $(p).find('> a').addClass 'matched-child' for p in node$.parent().parents 'li'


Response:
clearFilter = ->
  currentQuery = ''
  for nodeInfo in searchableNodes
    node$ = nodeInfo[1]
    node$.removeClass 'filtered matched-child'
    node$.text node$.text()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
clearFilter = ->
  currentQuery = ''
  for nodeInfo in searchableNodes
    node$ = nodeInfo[1]
    node$.removeClass 'filtered matched-child'
    node$.text node$.text()
```

Response:
var clearFilter;

clearFilter = function() {
  var currentQuery, i, len, node$, nodeInfo, results;
  currentQuery = '';
  results = [];
  for (i = 0, len = searchableNodes.length; i < len; i++) {
    nodeInfo = searchableNodes[i];
    node$ = nodeInfo[1];
    node$.removeClass('filtered matched-child');
    results.push(node$.text(node$.text()));
  }
  return results;
};


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

clearFilter = function() {
  var currentQuery, i, len, node$, nodeInfo, results;
  currentQuery = '';
  results = [];
  for (i = 0, len = searchableNodes.length; i < len; i++) {
    nodeInfo = searchableNodes[i];
    node$ = nodeInfo[1];
    node$.removeClass('filtered matched-child');
    results.push(node$.text(node$.text()));
  }
  return results;
};
```

Response:
clearFilter = ->
  currentQuery = ''
  for nodeInfo in searchableNodes
    node$ = nodeInfo[1]
    node$.removeClass 'filtered matched-child'
    node$.text node$.text()


Prompt:
clearFilter = ->
  currentQuery = ''
  for nodeInfo in searchableNodes

Response:
node$ = nodeInfo[1]
    node$.removeClass 'filtered matched-child'
    node$.text node$.text()


Response:
highlightMatch = (node$, queryString) ->
  nodeText  = node$.text()
  lowerText = nodeText.toLowerCase()

  markedText    = ''
  furthestIndex = 0

  for char in queryString
    foundIndex    = lowerText.indexOf char, furthestIndex
    markedText   += nodeText[furthestIndex...foundIndex] + "<em>#{nodeText[foundIndex]}</em>"
    furthestIndex = foundIndex + 1

  node$.html markedText + nodeText[furthestIndex...]

# ## DOM Construction


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
highlightMatch = (node$, queryString) ->
  nodeText  = node$.text()
  lowerText = nodeText.toLowerCase()

  markedText    = ''
  furthestIndex = 0

  for char in queryString
    foundIndex    = lowerText.indexOf char, furthestIndex
    markedText   += nodeText[furthestIndex...foundIndex] + "<em>#{nodeText[foundIndex]}</em>"
    furthestIndex = foundIndex + 1

  node$.html markedText + nodeText[furthestIndex...]

# ## DOM Construction
```

Response:
var highlightMatch;

highlightMatch = function(node$, queryString) {
  var char, foundIndex, furthestIndex, i, len, lowerText, markedText, nodeText;
  nodeText = node$.text();
  lowerText = nodeText.toLowerCase();
  markedText = '';
  furthestIndex = 0;
  for (i = 0, len = queryString.length; i < len; i++) {
    char = queryString[i];
    foundIndex = lowerText.indexOf(char, furthestIndex);
    markedText += nodeText.slice(furthestIndex, foundIndex) + `<em>${nodeText[foundIndex]}</em>`;
    furthestIndex = foundIndex + 1;
  }
  return node$.html(markedText + nodeText.slice(furthestIndex));
};

// ## DOM Construction


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

highlightMatch = function(node$, queryString) {
  var char, foundIndex, furthestIndex, i, len, lowerText, markedText, nodeText;
  nodeText = node$.text();
  lowerText = nodeText.toLowerCase();
  markedText = '';
  furthestIndex = 0;
  for (i = 0, len = queryString.length; i < len; i++) {
    char = queryString[i];
    foundIndex = lowerText.indexOf(char, furthestIndex);
    markedText += nodeText.slice(furthestIndex, foundIndex) + `<em>${nodeText[foundIndex]}</em>`;
    furthestIndex = foundIndex + 1;
  }
  return node$.html(markedText + nodeText.slice(furthestIndex));
};

// ## DOM Construction
```

Response:
highlightMatch = (node$, queryString) ->
  nodeText  = node$.text()
  lowerText = nodeText.toLowerCase()

  markedText    = ''
  furthestIndex = 0

  for char in queryString
    foundIndex    = lowerText.indexOf char, furthestIndex
    markedText   += nodeText[furthestIndex...foundIndex] + "<em>#{nodeText[foundIndex]}</em>"
    furthestIndex = foundIndex + 1

  node$.html markedText + nodeText[furthestIndex...]

# ## DOM Construction


Prompt:
highlightMatch = (node$, queryString) ->
  nodeText  = node$.text()
  lowerText = nodeText.toLowerCase()

  markedText    = ''
  furthestIndex = 0

  for char in queryString

Response:
foundIndex    = lowerText.indexOf char, furthestIndex
    markedText   += nodeText[furthestIndex...foundIndex] + "<em>#{nodeText[foundIndex]}</em>"
    furthestIndex = foundIndex + 1

  node$.html markedText + nodeText[furthestIndex...]

# ## DOM Construction


Response:
buildNav = (relativeRoot) ->
  nav$ = $("""

Table of Contents

<input id="search" type="search"/>

  """).appendTo $('body')
  toc$ = nav$.find '.toc'

  files = (f for f of outline).sort()

  for file in files
    filePath = "#{relativeRoot}#{file}.html"

    fileNode$ = $("""

        #{file}

    """).appendTo toc$

    appendSearchNode  fileNode$.find('a')
    appendHeaderNodes fileNode$, filePath, outline[file]

  nav$


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
buildNav = (relativeRoot) ->
  nav$ = $("""
    <nav>
      <ul class="tools">
        <li class="toggle">Table of Contents</li>
        <li class="search"><input id="search" type="search"/></li>
      </ul>
      <ol class="toc"/>
      </div>
    </nav>
  """).appendTo $('body')
  toc$ = nav$.find '.toc'

  files = (f for f of outline).sort()

  for file in files
    filePath = "#{relativeRoot}#{file}.html"

    fileNode$ = $("""
      <li class="file">
        <a href="#{filePath}">#{file}</a>
      </li>
    """).appendTo toc$

    appendSearchNode  fileNode$.find('a')
    appendHeaderNodes fileNode$, filePath, outline[file]

  nav$
```

Response:
var buildNav;

buildNav = function(relativeRoot) {
  var f, file, fileNode$, filePath, files, i, len, nav$, toc$;
  nav$ = $(`<nav>
  <ul class="tools">
    <li class="toggle">Table of Contents</li>
    <li class="search"><input id="search" type="search"/></li>
  </ul>
  <ol class="toc"/>
  </div>
</nav>`).appendTo($('body'));
  toc$ = nav$.find('.toc');
  files = ((function() {
    var results;
    results = [];
    for (f in outline) {
      results.push(f);
    }
    return results;
  })()).sort();
  for (i = 0, len = files.length; i < len; i++) {
    file = files[i];
    filePath = `${relativeRoot}${file}.html`;
    fileNode$ = $(`<li class="file">
  <a href="${filePath}">${file}</a>
</li>`).appendTo(toc$);
    appendSearchNode(fileNode$.find('a'));
    appendHeaderNodes(fileNode$, filePath, outline[file]);
  }
  return nav$;
};


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

buildNav = function(relativeRoot) {
  var f, file, fileNode$, filePath, files, i, len, nav$, toc$;
  nav$ = $(`<nav>
  <ul class="tools">
    <li class="toggle">Table of Contents</li>
    <li class="search"><input id="search" type="search"/></li>
  </ul>
  <ol class="toc"/>
  </div>
</nav>`).appendTo($('body'));
  toc$ = nav$.find('.toc');
  files = ((function() {
    var results;
    results = [];
    for (f in outline) {
      results.push(f);
    }
    return results;
  })()).sort();
  for (i = 0, len = files.length; i < len; i++) {
    file = files[i];
    filePath = `${relativeRoot}${file}.html`;
    fileNode$ = $(`<li class="file">
  <a href="${filePath}">${file}</a>
</li>`).appendTo(toc$);
    appendSearchNode(fileNode$.find('a'));
    appendHeaderNodes(fileNode$, filePath, outline[file]);
  }
  return nav$;
};
```

Response:
buildNav = (relativeRoot) ->
  nav$ = $("""
    <nav>
      <ul class="tools">
        <li class="toggle">Table of Contents</li>
        <li class="search"><input id="search" type="search"/></li>
      </ul>
      <ol class="toc"/>
      </div>
    </nav>
  """).appendTo $('body')
  toc$ = nav$.find '.toc'

  files = (f for f of outline).sort()

  for file in files
    filePath = "#{relativeRoot}#{file}.html"

    fileNode$ = $("""
      <li class="file">
        <a href="#{filePath}">#{file}</a>
      </li>
    """).appendTo toc$

    appendSearchNode  fileNode$.find('a')
    appendHeaderNodes fileNode$, filePath, outline[file]

  nav$


Prompt:
buildNav = (relativeRoot) ->
  nav$ = $("""

Table of Contents

<input id="search" type="search"/>

  """).appendTo $('body')
  toc$ = nav$.find '.toc'

  files = (f for f of outline).sort()

Response:
for file in files
    filePath = "#{relativeRoot}#{file}.html"

    fileNode$ = $("""

        #{file}

    """).appendTo toc$

    appendSearchNode  fileNode$.find('a')
    appendHeaderNodes fileNode$, filePath, outline[file]

  nav$


Response:
appendHeaderNodes = (target$, filePath, nodeList) ->
  return unless nodeList.length > 0

  targetList$ = $('
').appendTo target$

  for node in nodeList
    node$ = $("""

        #{node.data.title}

    """).appendTo targetList$
    appendSearchNode node$.find('a')

    appendHeaderNodes node$, filePath, node.children

$ ->
  relativeRoot = $('meta[name="lidoc-relative-root"]').attr('content')
  nav$ = buildNav relativeRoot

  search$ = $('#search')
  search$.bind 'keyup search', (evt) =>
    searchNodes search$.val()

  search$.keydown (evt) =>
    if evt.keyCode == 27 # Esc
      if search$.val().trim() == ''
        search$.blur()
      else
        search$.val ''

  search$.focus (evt) => nav$.addClass 'active'
  search$.blur  (evt) => nav$.removeClass 'active'

  nav$.click (evt) =>
    search$.focus()

  nav$.mousedown (evt) =>
    if search$.is(':focus') and evt.target != search$[0]
      evt.preventDefault()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
appendHeaderNodes = (target$, filePath, nodeList) ->
  return unless nodeList.length > 0

  targetList$ = $('<ol/>').appendTo target$

  for node in nodeList
    node$ = $("""
      <li class="header">
        <a href="#{filePath}##{node.data.slug}">#{node.data.title}</a>
      </li>
    """).appendTo targetList$
    appendSearchNode node$.find('a')

    appendHeaderNodes node$, filePath, node.children

$ ->
  relativeRoot = $('meta[name="lidoc-relative-root"]').attr('content')
  nav$ = buildNav relativeRoot

  search$ = $('#search')
  search$.bind 'keyup search', (evt) =>
    searchNodes search$.val()

  search$.keydown (evt) =>
    if evt.keyCode == 27 # Esc
      if search$.val().trim() == ''
        search$.blur()
      else
        search$.val ''

  search$.focus (evt) => nav$.addClass 'active'
  search$.blur  (evt) => nav$.removeClass 'active'

  nav$.click (evt) =>
    search$.focus()

  nav$.mousedown (evt) =>
    if search$.is(':focus') and evt.target != search$[0]
      evt.preventDefault()
```

Response:
var appendHeaderNodes;

appendHeaderNodes = function(target$, filePath, nodeList) {
  var i, len, node, node$, results, targetList$;
  if (!(nodeList.length > 0)) {
    return;
  }
  targetList$ = $('
').appendTo(target$);
  results = [];
  for (i = 0, len = nodeList.length; i < len; i++) {
    node = nodeList[i];
    node$ = $(`

  ${node.data.title}

`).appendTo(targetList$);
    appendSearchNode(node$.find('a'));
    results.push(appendHeaderNodes(node$, filePath, node.children));
  }
  return results;
};

$(function() {
  var nav$, relativeRoot, search$;
  relativeRoot = $('meta[name="lidoc-relative-root"]').attr('content');
  nav$ = buildNav(relativeRoot);
  search$ = $('#search');
  search$.bind('keyup search', (evt) => {
    return searchNodes(search$.val());
  });
  search$.keydown((evt) => {
    if (evt.keyCode === 27) { // Esc
      if (search$.val().trim() === '') {
        return search$.blur();
      } else {
        return search$.val('');
      }
    }
  });
  search$.focus((evt) => {
    return nav$.addClass('active');
  });
  search$.blur((evt) => {
    return nav$.removeClass('active');
  });
  nav$.click((evt) => {
    return search$.focus();
  });
  return nav$.mousedown((evt) => {
    if (search$.is(':focus') && evt.target !== search$[0]) {
      return evt.preventDefault();
    }
  });
});