Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class extends TransformerBase

  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      if @options.compat
        @escapeJs node, parenthesized: true
      else
        @warn node, "Named function expressions are not supported in CoffeeScript"
        node
    else
      node

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###
```

Response:
module.exports = class extends TransformerBase {
  onScopeEnter(scope, ctx) {
    // Keep a list of things to be prepended before the body
    return ctx.prebody = [];
  }

  onScopeExit(scope, ctx, subscope, subctx) {
    if (subctx.prebody.length) {
      return this.prependIntoBody(scope.body, subctx.prebody);
    }
  }

  // prepend the functions back into the body.
  // be sure to place them after variable declarations.
  prependIntoBody(body, prebody) {
    var idx;
    idx = firstNonVar(body);
    return body.splice(idx, 0, ...prebody);
  }

  FunctionDeclaration(node) {
    this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    this.pushStack(node.body);
  }

  FunctionDeclarationExit(node) {
    this.popStack(node);
    return this.remove();
  }

  LineComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  BlockComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  FunctionExpression(node) {
    this.pushStack(node.body);
  }

  FunctionExpressionExit(node) {
    this.popStack();
    if (node.id) {
      if (this.options.compat) {
        return this.escapeJs(node, {
          parenthesized: true
        });
      } else {
        this.warn(node, "Named function expressions are not supported in CoffeeScript");
        return node;
      }
    } else {
      return node;
    }
  }

};

/*
 * If a comment is adjacent to a function,
 * move them up as well together with the function.
 */


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = class extends TransformerBase {
  onScopeEnter(scope, ctx) {
    // Keep a list of things to be prepended before the body
    return ctx.prebody = [];
  }

  onScopeExit(scope, ctx, subscope, subctx) {
    if (subctx.prebody.length) {
      return this.prependIntoBody(scope.body, subctx.prebody);
    }
  }

  // prepend the functions back into the body.
  // be sure to place them after variable declarations.
  prependIntoBody(body, prebody) {
    var idx;
    idx = firstNonVar(body);
    return body.splice(idx, 0, ...prebody);
  }

  FunctionDeclaration(node) {
    this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    this.pushStack(node.body);
  }

  FunctionDeclarationExit(node) {
    this.popStack(node);
    return this.remove();
  }

  LineComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  BlockComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  FunctionExpression(node) {
    this.pushStack(node.body);
  }

  FunctionExpressionExit(node) {
    this.popStack();
    if (node.id) {
      if (this.options.compat) {
        return this.escapeJs(node, {
          parenthesized: true
        });
      } else {
        this.warn(node, "Named function expressions are not supported in CoffeeScript");
        return node;
      }
    } else {
      return node;
    }
  }

};

/*
 * If a comment is adjacent to a function,
 * move them up as well together with the function.
 */
```

Response:
module.exports = class extends TransformerBase

  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      if @options.compat
        @escapeJs node, parenthesized: true
      else
        @warn node, "Named function expressions are not supported in CoffeeScript"
        node
    else
      node

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###


Prompt:
module.exports = class extends TransformerBase

  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

Response:
LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      if @options.compat
        @escapeJs node, parenthesized: true
      else
        @warn node, "Named function expressions are not supported in CoffeeScript"
        node
    else
      node

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###


Response:
module.exports = class extends TransformerBase

  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = class extends TransformerBase

  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
```

Response:
module.exports = class extends TransformerBase {
  onScopeEnter(scope, ctx) {
    // Keep a list of things to be prepended before the body
    return ctx.prebody = [];
  }

  onScopeExit(scope, ctx, subscope, subctx) {
    if (subctx.prebody.length) {
      return this.prependIntoBody(scope.body, subctx.prebody);
    }
  }

  // prepend the functions back into the body.
  // be sure to place them after variable declarations.
  prependIntoBody(body, prebody) {
    var idx;
    idx = firstNonVar(body);
    return body.splice(idx, 0, ...prebody);
  }

  FunctionDeclaration(node) {
    this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    this.pushStack(node.body);
  }

  FunctionDeclarationExit(node) {
    this.popStack(node);
    return this.remove();
  }

  LineComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  BlockComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  FunctionExpression(node) {
    if (node.id) {
      this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    }
    this.pushStack(node.body);
  }

  FunctionExpressionExit(node) {
    this.popStack();
    if (node.id) {
      return {
        type: 'Identifier',
        name: node.id.name
      };
    }
  }

  /*
   * If a comment is adjacent to a function,
   * move them up as well together with the function.
   */
  moveFunctionComments(node, parent) {
    var next;
    if (!parent.body) {
      return;
    }
    return next = nextNonComment(parent.body, node);
  }

};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = class extends TransformerBase {
  onScopeEnter(scope, ctx) {
    // Keep a list of things to be prepended before the body
    return ctx.prebody = [];
  }

  onScopeExit(scope, ctx, subscope, subctx) {
    if (subctx.prebody.length) {
      return this.prependIntoBody(scope.body, subctx.prebody);
    }
  }

  // prepend the functions back into the body.
  // be sure to place them after variable declarations.
  prependIntoBody(body, prebody) {
    var idx;
    idx = firstNonVar(body);
    return body.splice(idx, 0, ...prebody);
  }

  FunctionDeclaration(node) {
    this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    this.pushStack(node.body);
  }

  FunctionDeclarationExit(node) {
    this.popStack(node);
    return this.remove();
  }

  LineComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  BlockComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  FunctionExpression(node) {
    if (node.id) {
      this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    }
    this.pushStack(node.body);
  }

  FunctionExpressionExit(node) {
    this.popStack();
    if (node.id) {
      return {
        type: 'Identifier',
        name: node.id.name
      };
    }
  }

  /*
   * If a comment is adjacent to a function,
   * move them up as well together with the function.
   */
  moveFunctionComments(node, parent) {
    var next;
    if (!parent.body) {
      return;
    }
    return next = nextNonComment(parent.body, node);
  }

};
```

Response:
module.exports = class extends TransformerBase

  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)


Prompt:
module.exports = class extends TransformerBase

  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

Response:
LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)


Response:
return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn
      @ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]

###
# Looks up the first non-variable-declaration in a body
###


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn
      @ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]

###
# Looks up the first non-variable-declaration in a body
###
```

Response:
var isFn;

if (!next) {
  isFn = next.type === 'FunctionExpression' && next.id;
  isFn || (isFn = next.type === 'FunctionDeclaration');
  if (isFn) {
    this.ctx.prebody.push(node);
    return this.remove();
  }
}

({
  /*
   * Returns a `a = -> ...` statement out of a FunctionDeclaration node.
   */
  buildFunctionDeclaration: function(node) {
    return replace(node, {
      type: 'VariableDeclaration',
      declarations: [
        {
          type: 'VariableDeclarator',
          id: node.id,
          init: {
            type: 'FunctionExpression',
            params: node.params,
            defaults: node.defaults,
            body: node.body
          }
        }
      ]
    });
  }
});

/*
 * Looks up the first non-variable-declaration in a body
 */


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

if (!next) {
  isFn = next.type === 'FunctionExpression' && next.id;
  isFn || (isFn = next.type === 'FunctionDeclaration');
  if (isFn) {
    this.ctx.prebody.push(node);
    return this.remove();
  }
}

({
  /*
   * Returns a `a = -> ...` statement out of a FunctionDeclaration node.
   */
  buildFunctionDeclaration: function(node) {
    return replace(node, {
      type: 'VariableDeclaration',
      declarations: [
        {
          type: 'VariableDeclarator',
          id: node.id,
          init: {
            type: 'FunctionExpression',
            params: node.params,
            defaults: node.defaults,
            body: node.body
          }
        }
      ]
    });
  }
});

/*
 * Looks up the first non-variable-declaration in a body
 */
```

Response:
return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn
      @ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]

###
# Looks up the first non-variable-declaration in a body
###


Prompt:
return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn
      @ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->

Response:
replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]

###
# Looks up the first non-variable-declaration in a body
###


Response:
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next
```

Response:
var FunctionTransforms;

FunctionTransforms = class FunctionTransforms extends TransformerBase {
  onScopeEnter(scope, ctx) {
    // Keep a list of things to be prepended before the body
    return ctx.prebody = [];
  }

  onScopeExit(scope, ctx, subscope, subctx) {
    if (subctx.prebody.length) {
      return this.prependIntoBody(scope.body, subctx.prebody);
    }
  }

  // prepend the functions back into the body.
  // be sure to place them after variable declarations.
  prependIntoBody(body, prebody) {
    var idx;
    idx = firstNonVar(body);
    return body.splice(idx, 0, ...prebody);
  }

  FunctionDeclaration(node) {
    this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    this.pushStack(node.body);
  }

  FunctionDeclarationExit(node) {
    this.popStack(node);
    return this.remove();
  }

  LineComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  BlockComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  FunctionExpression(node) {
    if (node.id) {
      this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    }
    this.pushStack(node.body);
  }

  FunctionExpressionExit(node) {
    this.popStack();
    if (node.id) {
      return {
        type: 'Identifier',
        name: node.id.name
      };
    }
  }

  /*
   * If a comment is adjacent to a function,
   * move them up as well together with the function.
   */
  moveFunctionComments(node, parent) {
    var next;
    if (!parent.body) {
      return;
    }
    next = nextNonComment(parent.body, node);
    if (!next) {

    }
  }

};


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

FunctionTransforms = class FunctionTransforms extends TransformerBase {
  onScopeEnter(scope, ctx) {
    // Keep a list of things to be prepended before the body
    return ctx.prebody = [];
  }

  onScopeExit(scope, ctx, subscope, subctx) {
    if (subctx.prebody.length) {
      return this.prependIntoBody(scope.body, subctx.prebody);
    }
  }

  // prepend the functions back into the body.
  // be sure to place them after variable declarations.
  prependIntoBody(body, prebody) {
    var idx;
    idx = firstNonVar(body);
    return body.splice(idx, 0, ...prebody);
  }

  FunctionDeclaration(node) {
    this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    this.pushStack(node.body);
  }

  FunctionDeclarationExit(node) {
    this.popStack(node);
    return this.remove();
  }

  LineComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  BlockComment(node, parent) {
    return this.moveFunctionComments(node, parent);
  }

  FunctionExpression(node) {
    if (node.id) {
      this.ctx.prebody.push(this.buildFunctionDeclaration(node));
    }
    this.pushStack(node.body);
  }

  FunctionExpressionExit(node) {
    this.popStack();
    if (node.id) {
      return {
        type: 'Identifier',
        name: node.id.name
      };
    }
  }

  /*
   * If a comment is adjacent to a function,
   * move them up as well together with the function.
   */
  moveFunctionComments(node, parent) {
    var next;
    if (!parent.body) {
      return;
    }
    next = nextNonComment(parent.body, node);
    if (!next) {

    }
  }

};
```

Response:
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next


Prompt:
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    if subctx.prebody.length
      @prependIntoBody(scope.body, subctx.prebody)

  # prepend the functions back into the body.
  # be sure to place them after variable declarations.
  prependIntoBody: (body, prebody) ->
    idx = firstNonVar(body)
    body.splice(idx, 0, prebody...)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->

Response:
@moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next


Response:
isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn
      @ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]

###
# Looks up the first non-variable-declaration in a body
###


Prompt:
isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn
      @ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,

Response:
type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]

###
# Looks up the first non-variable-declaration in a body
###


Response:
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    # prepend the functions back into the body
    if subctx.prebody.length
      scope.body = subctx.prebody.concat(scope.body)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn


Prompt:
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    # prepend the functions back into the body
    if subctx.prebody.length
      scope.body = subctx.prebody.concat(scope.body)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    @remove()

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

Response:
FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn


Response:
@ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]


Prompt:
@ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,

Response:
type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          defaults: node.defaults
          body: node.body
      ]


Response:
@ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          body: node.body
      ]


Prompt:
@ctx.prebody.push node
      @remove()

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,

Response:
type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          body: node.body
      ]


Response:
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    # prepend the functions back into the body
    if subctx.prebody.length
      scope.body = subctx.prebody.concat(scope.body)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    { type: 'EmptyStatement' }

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn


Prompt:
class FunctionTransforms extends TransformerBase
  onScopeEnter: (scope, ctx) ->
    # Keep a list of things to be prepended before the body
    ctx.prebody = []

  onScopeExit: (scope, ctx, subscope, subctx) ->
    # prepend the functions back into the body
    if subctx.prebody.length
      scope.body = subctx.prebody.concat(scope.body)

  FunctionDeclaration: (node) ->
    @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionDeclarationExit: (node) ->
    @popStack(node)
    { type: 'EmptyStatement' }

  LineComment: (node, parent) ->
    @moveFunctionComments(node, parent)

  BlockComment: (node, parent) ->
    @moveFunctionComments(node, parent)

Response:
FunctionExpression: (node) ->
    if node.id
      @ctx.prebody.push @buildFunctionDeclaration(node)
    @pushStack(node.body)
    return

  FunctionExpressionExit: (node) ->
    @popStack()
    if node.id
      { type: 'Identifier', name: node.id.name }

  ###
  # If a comment is adjacent to a function,
  # move them up as well together with the function.
  ###

  moveFunctionComments: (node, parent) ->
    return unless parent.body
    next = nextNonComment(parent.body, node)
    return unless next

    isFn = (next.type is 'FunctionExpression' and next.id)
    isFn ||= (next.type is 'FunctionDeclaration')

    if isFn


Response:
@ctx.prebody.push node
      { type: 'EmptyStatement' }

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,
      type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          body: node.body
      ]


Prompt:
@ctx.prebody.push node
      { type: 'EmptyStatement' }

  ###
  # Returns a `a = -> ...` statement out of a FunctionDeclaration node.
  ###

  buildFunctionDeclaration: (node) ->
    replace node,

Response:
type: 'VariableDeclaration'
      declarations: [
        type: 'VariableDeclarator'
        id: node.id
        init:
          type: 'FunctionExpression'
          params: node.params
          body: node.body
      ]


Response:
callWithJQuery = (pivotModule) ->
    if typeof exports is "object" and typeof module is "object" # CommonJS
        pivotModule require("jquery")
    else if typeof define is "function" and define.amd # AMD
        define ["jquery"], pivotModule
    # Plain browser env
    else
        pivotModule jQuery

callWithJQuery ($) ->

    $.pivotUtilities.export_renderers = "TSV Export": (pivotData, opts) ->
        defaults =
            localeStrings: {}

        opts = $.extend defaults, opts

        rowKeys = pivotData.getRowKeys()
        rowKeys.push [] if rowKeys.length == 0
        colKeys = pivotData.getColKeys()
        colKeys.push [] if colKeys.length == 0
        rowAttrs = pivotData.rowAttrs
        colAttrs = pivotData.colAttrs

        result = []

        row = []
        for rowAttr in rowAttrs
            row.push rowAttr
        if colKeys.length == 1 and colKeys[0].length == 0
            row.push pivotData.aggregatorName
        else
            for colKey in colKeys
                row.push colKey.join("-")

        result.push row

        for rowKey in rowKeys
            row = []
            for r in rowKey
                row.push r

            for colKey in colKeys
                agg = pivotData.getAggregator(rowKey, colKey)
                if agg.value()?
                    row.push agg.value()
                else
                    row.push ""
            result.push row
        text = ""


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
callWithJQuery = (pivotModule) ->
    if typeof exports is "object" and typeof module is "object" # CommonJS
        pivotModule require("jquery")
    else if typeof define is "function" and define.amd # AMD
        define ["jquery"], pivotModule
    # Plain browser env
    else
        pivotModule jQuery

callWithJQuery ($) ->

    $.pivotUtilities.export_renderers = "TSV Export": (pivotData, opts) ->
        defaults =
            localeStrings: {}

        opts = $.extend defaults, opts

        rowKeys = pivotData.getRowKeys()
        rowKeys.push [] if rowKeys.length == 0
        colKeys = pivotData.getColKeys()
        colKeys.push [] if colKeys.length == 0
        rowAttrs = pivotData.rowAttrs
        colAttrs = pivotData.colAttrs

        result = []

        row = []
        for rowAttr in rowAttrs
            row.push rowAttr
        if colKeys.length == 1 and colKeys[0].length == 0
            row.push pivotData.aggregatorName
        else
            for colKey in colKeys
                row.push colKey.join("-")

        result.push row

        for rowKey in rowKeys
            row = []
            for r in rowKey
                row.push r

            for colKey in colKeys
                agg = pivotData.getAggregator(rowKey, colKey)
                if agg.value()?
                    row.push agg.value()
                else
                    row.push ""
            result.push row
        text = ""
```

Response:
var callWithJQuery;

callWithJQuery = function(pivotModule) {
  if (typeof exports === "object" && typeof module === "object") { // CommonJS
    return pivotModule(require("jquery"));
  } else if (typeof define === "function" && define.amd) { // AMD
    return define(["jquery"], pivotModule);
  } else {
    // Plain browser env
    return pivotModule(jQuery);
  }
};

callWithJQuery(function($) {
  return $.pivotUtilities.export_renderers = {
    "TSV Export": function(pivotData, opts) {
      var agg, colAttrs, colKey, colKeys, defaults, i, j, k, l, len, len1, len2, len3, len4, m, r, result, row, rowAttr, rowAttrs, rowKey, rowKeys, text;
      defaults = {
        localeStrings: {}
      };
      opts = $.extend(defaults, opts);
      rowKeys = pivotData.getRowKeys();
      if (rowKeys.length === 0) {
        rowKeys.push([]);
      }
      colKeys = pivotData.getColKeys();
      if (colKeys.length === 0) {
        colKeys.push([]);
      }
      rowAttrs = pivotData.rowAttrs;
      colAttrs = pivotData.colAttrs;
      result = [];
      row = [];
      for (i = 0, len = rowAttrs.length; i < len; i++) {
        rowAttr = rowAttrs[i];
        row.push(rowAttr);
      }
      if (colKeys.length === 1 && colKeys[0].length === 0) {
        row.push(pivotData.aggregatorName);
      } else {
        for (j = 0, len1 = colKeys.length; j < len1; j++) {
          colKey = colKeys[j];
          row.push(colKey.join("-"));
        }
      }
      result.push(row);
      for (k = 0, len2 = rowKeys.length; k < len2; k++) {
        rowKey = rowKeys[k];
        row = [];
        for (l = 0, len3 = rowKey.length; l < len3; l++) {
          r = rowKey[l];
          row.push(r);
        }
        for (m = 0, len4 = colKeys.length; m < len4; m++) {
          colKey = colKeys[m];
          agg = pivotData.getAggregator(rowKey, colKey);
          if (agg.value() != null) {
            row.push(agg.value());
          } else {
            row.push("");
          }
        }
        result.push(row);
      }
      return text = "";
    }
  };
});


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

callWithJQuery = function(pivotModule) {
  if (typeof exports === "object" && typeof module === "object") { // CommonJS
    return pivotModule(require("jquery"));
  } else if (typeof define === "function" && define.amd) { // AMD
    return define(["jquery"], pivotModule);
  } else {
    // Plain browser env
    return pivotModule(jQuery);
  }
};

callWithJQuery(function($) {
  return $.pivotUtilities.export_renderers = {
    "TSV Export": function(pivotData, opts) {
      var agg, colAttrs, colKey, colKeys, defaults, i, j, k, l, len, len1, len2, len3, len4, m, r, result, row, rowAttr, rowAttrs, rowKey, rowKeys, text;
      defaults = {
        localeStrings: {}
      };
      opts = $.extend(defaults, opts);
      rowKeys = pivotData.getRowKeys();
      if (rowKeys.length === 0) {
        rowKeys.push([]);
      }
      colKeys = pivotData.getColKeys();
      if (colKeys.length === 0) {
        colKeys.push([]);
      }
      rowAttrs = pivotData.rowAttrs;
      colAttrs = pivotData.colAttrs;
      result = [];
      row = [];
      for (i = 0, len = rowAttrs.length; i < len; i++) {
        rowAttr = rowAttrs[i];
        row.push(rowAttr);
      }
      if (colKeys.length === 1 && colKeys[0].length === 0) {
        row.push(pivotData.aggregatorName);
      } else {
        for (j = 0, len1 = colKeys.length; j < len1; j++) {
          colKey = colKeys[j];
          row.push(colKey.join("-"));
        }
      }
      result.push(row);
      for (k = 0, len2 = rowKeys.length; k < len2; k++) {
        rowKey = rowKeys[k];
        row = [];
        for (l = 0, len3 = rowKey.length; l < len3; l++) {
          r = rowKey[l];
          row.push(r);
        }
        for (m = 0, len4 = colKeys.length; m < len4; m++) {
          colKey = colKeys[m];
          agg = pivotData.getAggregator(rowKey, colKey);
          if (agg.value() != null) {
            row.push(agg.value());
          } else {
            row.push("");
          }
        }
        result.push(row);
      }
      return text = "";
    }
  };
});
```

Response:
callWithJQuery = (pivotModule) ->
    if typeof exports is "object" and typeof module is "object" # CommonJS
        pivotModule require("jquery")
    else if typeof define is "function" and define.amd # AMD
        define ["jquery"], pivotModule
    # Plain browser env
    else
        pivotModule jQuery

callWithJQuery ($) ->

    $.pivotUtilities.export_renderers = "TSV Export": (pivotData, opts) ->
        defaults =
            localeStrings: {}

        opts = $.extend defaults, opts

        rowKeys = pivotData.getRowKeys()
        rowKeys.push [] if rowKeys.length == 0
        colKeys = pivotData.getColKeys()
        colKeys.push [] if colKeys.length == 0
        rowAttrs = pivotData.rowAttrs
        colAttrs = pivotData.colAttrs

        result = []

        row = []
        for rowAttr in rowAttrs
            row.push rowAttr
        if colKeys.length == 1 and colKeys[0].length == 0
            row.push pivotData.aggregatorName
        else
            for colKey in colKeys
                row.push colKey.join("-")

        result.push row

        for rowKey in rowKeys
            row = []
            for r in rowKey
                row.push r

            for colKey in colKeys
                agg = pivotData.getAggregator(rowKey, colKey)
                if agg.value()?
                    row.push agg.value()
                else
                    row.push ""
            result.push row
        text = ""


Prompt:
callWithJQuery = (pivotModule) ->
    if typeof exports is "object" and typeof module is "object" # CommonJS
        pivotModule require("jquery")
    else if typeof define is "function" and define.amd # AMD
        define ["jquery"], pivotModule
    # Plain browser env
    else
        pivotModule jQuery

callWithJQuery ($) ->

    $.pivotUtilities.export_renderers = "TSV Export": (pivotData, opts) ->
        defaults =
            localeStrings: {}

        opts = $.extend defaults, opts

        rowKeys = pivotData.getRowKeys()
        rowKeys.push [] if rowKeys.length == 0
        colKeys = pivotData.getColKeys()
        colKeys.push [] if colKeys.length == 0
        rowAttrs = pivotData.rowAttrs
        colAttrs = pivotData.colAttrs

        result = []

Response:
row = []
        for rowAttr in rowAttrs
            row.push rowAttr
        if colKeys.length == 1 and colKeys[0].length == 0
            row.push pivotData.aggregatorName
        else
            for colKey in colKeys
                row.push colKey.join("-")

        result.push row

        for rowKey in rowKeys
            row = []
            for r in rowKey
                row.push r

            for colKey in colKeys
                agg = pivotData.getAggregator(rowKey, colKey)
                if agg.value()?
                    row.push agg.value()
                else
                    row.push ""
            result.push row
        text = ""


Response:
for r in result
            text += r.join("\t")+"\n"

        return $("<textarea>").text(text).css(
                width: ($(window).width() / 2) + "px",
                height: ($(window).height() / 2) + "px")


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
for r in result
            text += r.join("\t")+"\n"

        return $("<textarea>").text(text).css(
                width: ($(window).width() / 2) + "px",
                height: ($(window).height() / 2) + "px")
```

Response:
var i, len, r;

for (i = 0, len = result.length; i < len; i++) {
  r = result[i];
  text += r.join("\t") + "\n";
}

return $("<textarea>").text(text).css({
  width: ($(window).width() / 2) + "px",
  height: ($(window).height() / 2) + "px"
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var i, len, r;

for (i = 0, len = result.length; i < len; i++) {
  r = result[i];
  text += r.join("\t") + "\n";
}

return $("<textarea>").text(text).css({
  width: ($(window).width() / 2) + "px",
  height: ($(window).height() / 2) + "px"
});
```

Response:
for r in result
            text += r.join("\t")+"\n"

        return $("<textarea>").text(text).css(
                width: ($(window).width() / 2) + "px",
                height: ($(window).height() / 2) + "px")


Prompt:
for r in result
            text += r.join("\t")+"\n"

Response:
return $("<textarea>").text(text).css(
                width: ($(window).width() / 2) + "px",
                height: ($(window).height() / 2) + "px")


Response:
module.exports = React.createClass
  displayName: 'team-invite'
  mixins: [ PureRenderMixin, mixinSubscribe ]

  propTypes:
    _teamId: T.string.isRequired
    contacts: T.instanceOf(Immutable.List).isRequired
    invitations: T.instanceOf(Immutable.List).isRequired
    onBatchInviteClick: T.func.isRequired

  getInitialState: ->
    type: 'invite'
    team: @getTeam()
    invitee: ''
    invitees: ''

  componentDidMount: ->
    @subscribe recorder, =>
      @setState team: @getTeam()

  getTeam: ->
    query.teamBy recorder.getState(), @props._teamId

  getUniqueInvitations: ->
    @props.invitations
    .groupBy((cursor) -> cursor.get('key'))
    .map((cursor) -> cursor.first())
    .toList()

  sendInvite: ->
    invitee = @state.invitee

    if invitee.length and not (util.isEmail(invitee) or util.isMobile(invitee))
      notifyActions.error l('room-members-invalid')
    else if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else if @getUniqueInvitations().some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else
      if util.isEmail invitee
        Invitee = email: invitee
      else if util.isMobile invitee
        Invitee = mobile: invitee
      if Invitee?
        teamActions.teamInvite @props._teamId, Invitee,
          =>
            @setState invitee: ''

            if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('mobile')])
              notifyActions.success l('room-members-added')


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
  displayName: 'team-invite'
  mixins: [ PureRenderMixin, mixinSubscribe ]

  propTypes:
    _teamId: T.string.isRequired
    contacts: T.instanceOf(Immutable.List).isRequired
    invitations: T.instanceOf(Immutable.List).isRequired
    onBatchInviteClick: T.func.isRequired

  getInitialState: ->
    type: 'invite'
    team: @getTeam()
    invitee: ''
    invitees: ''

  componentDidMount: ->
    @subscribe recorder, =>
      @setState team: @getTeam()

  getTeam: ->
    query.teamBy recorder.getState(), @props._teamId

  getUniqueInvitations: ->
    @props.invitations
    .groupBy((cursor) -> cursor.get('key'))
    .map((cursor) -> cursor.first())
    .toList()

  sendInvite: ->
    invitee = @state.invitee

    if invitee.length and not (util.isEmail(invitee) or util.isMobile(invitee))
      notifyActions.error l('room-members-invalid')
    else if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else if @getUniqueInvitations().some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else
      if util.isEmail invitee
        Invitee = email: invitee
      else if util.isMobile invitee
        Invitee = mobile: invitee
      if Invitee?
        teamActions.teamInvite @props._teamId, Invitee,
          =>
            @setState invitee: ''

            if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('mobile')])
              notifyActions.success l('room-members-added')
```

Response:
module.exports = React.createClass({
  displayName: 'team-invite',
  mixins: [PureRenderMixin, mixinSubscribe],
  propTypes: {
    _teamId: T.string.isRequired,
    contacts: T.instanceOf(Immutable.List).isRequired,
    invitations: T.instanceOf(Immutable.List).isRequired,
    onBatchInviteClick: T.func.isRequired
  },
  getInitialState: function() {
    return {
      type: 'invite',
      team: this.getTeam(),
      invitee: '',
      invitees: ''
    };
  },
  componentDidMount: function() {
    return this.subscribe(recorder, () => {
      return this.setState({
        team: this.getTeam()
      });
    });
  },
  getTeam: function() {
    return query.teamBy(recorder.getState(), this.props._teamId);
  },
  getUniqueInvitations: function() {
    return this.props.invitations.groupBy(function(cursor) {
      return cursor.get('key');
    }).map(function(cursor) {
      return cursor.first();
    }).toList();
  },
  sendInvite: function() {
    var Invitee, invitee;
    invitee = this.state.invitee;
    if (invitee.length && !(util.isEmail(invitee) || util.isMobile(invitee))) {
      return notifyActions.error(l('room-members-invalid'));
    } else if (this.props.contacts.some(function(x) {
      return invitee === x.get('email') || invitee === x.get('phoneForLogin');
    })) {
      return notifyActions.error(l('room-members-exists'));
    } else if (this.getUniqueInvitations().some(function(x) {
      return invitee === x.get('email') || invitee === x.get('phoneForLogin');
    })) {
      return notifyActions.error(l('room-members-exists'));
    } else {
      if (util.isEmail(invitee)) {
        Invitee = {
          email: invitee
        };
      } else if (util.isMobile(invitee)) {
        Invitee = {
          mobile: invitee
        };
      }
      if (Invitee != null) {
        return teamActions.teamInvite(this.props._teamId, Invitee, () => {
          this.setState({
            invitee: ''
          });
          if (this.props.contacts.some(function(x) {
            return invitee === x.get('email') || invitee === x.get('mobile');
          })) {
            return notifyActions.success(l('room-members-added'));
          }
        });
      }
    }
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
  displayName: 'team-invite',
  mixins: [PureRenderMixin, mixinSubscribe],
  propTypes: {
    _teamId: T.string.isRequired,
    contacts: T.instanceOf(Immutable.List).isRequired,
    invitations: T.instanceOf(Immutable.List).isRequired,
    onBatchInviteClick: T.func.isRequired
  },
  getInitialState: function() {
    return {
      type: 'invite',
      team: this.getTeam(),
      invitee: '',
      invitees: ''
    };
  },
  componentDidMount: function() {
    return this.subscribe(recorder, () => {
      return this.setState({
        team: this.getTeam()
      });
    });
  },
  getTeam: function() {
    return query.teamBy(recorder.getState(), this.props._teamId);
  },
  getUniqueInvitations: function() {
    return this.props.invitations.groupBy(function(cursor) {
      return cursor.get('key');
    }).map(function(cursor) {
      return cursor.first();
    }).toList();
  },
  sendInvite: function() {
    var Invitee, invitee;
    invitee = this.state.invitee;
    if (invitee.length && !(util.isEmail(invitee) || util.isMobile(invitee))) {
      return notifyActions.error(l('room-members-invalid'));
    } else if (this.props.contacts.some(function(x) {
      return invitee === x.get('email') || invitee === x.get('phoneForLogin');
    })) {
      return notifyActions.error(l('room-members-exists'));
    } else if (this.getUniqueInvitations().some(function(x) {
      return invitee === x.get('email') || invitee === x.get('phoneForLogin');
    })) {
      return notifyActions.error(l('room-members-exists'));
    } else {
      if (util.isEmail(invitee)) {
        Invitee = {
          email: invitee
        };
      } else if (util.isMobile(invitee)) {
        Invitee = {
          mobile: invitee
        };
      }
      if (Invitee != null) {
        return teamActions.teamInvite(this.props._teamId, Invitee, () => {
          this.setState({
            invitee: ''
          });
          if (this.props.contacts.some(function(x) {
            return invitee === x.get('email') || invitee === x.get('mobile');
          })) {
            return notifyActions.success(l('room-members-added'));
          }
        });
      }
    }
  }
});
```

Response:
module.exports = React.createClass
  displayName: 'team-invite'
  mixins: [ PureRenderMixin, mixinSubscribe ]

  propTypes:
    _teamId: T.string.isRequired
    contacts: T.instanceOf(Immutable.List).isRequired
    invitations: T.instanceOf(Immutable.List).isRequired
    onBatchInviteClick: T.func.isRequired

  getInitialState: ->
    type: 'invite'
    team: @getTeam()
    invitee: ''
    invitees: ''

  componentDidMount: ->
    @subscribe recorder, =>
      @setState team: @getTeam()

  getTeam: ->
    query.teamBy recorder.getState(), @props._teamId

  getUniqueInvitations: ->
    @props.invitations
    .groupBy((cursor) -> cursor.get('key'))
    .map((cursor) -> cursor.first())
    .toList()

  sendInvite: ->
    invitee = @state.invitee

    if invitee.length and not (util.isEmail(invitee) or util.isMobile(invitee))
      notifyActions.error l('room-members-invalid')
    else if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else if @getUniqueInvitations().some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else
      if util.isEmail invitee
        Invitee = email: invitee
      else if util.isMobile invitee
        Invitee = mobile: invitee
      if Invitee?
        teamActions.teamInvite @props._teamId, Invitee,
          =>
            @setState invitee: ''

            if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('mobile')])
              notifyActions.success l('room-members-added')


Prompt:
module.exports = React.createClass
  displayName: 'team-invite'
  mixins: [ PureRenderMixin, mixinSubscribe ]

  propTypes:
    _teamId: T.string.isRequired
    contacts: T.instanceOf(Immutable.List).isRequired
    invitations: T.instanceOf(Immutable.List).isRequired
    onBatchInviteClick: T.func.isRequired

  getInitialState: ->
    type: 'invite'
    team: @getTeam()
    invitee: ''
    invitees: ''

  componentDidMount: ->
    @subscribe recorder, =>
      @setState team: @getTeam()

  getTeam: ->
    query.teamBy recorder.getState(), @props._teamId

  getUniqueInvitations: ->
    @props.invitations

Response:
.groupBy((cursor) -> cursor.get('key'))
    .map((cursor) -> cursor.first())
    .toList()

  sendInvite: ->
    invitee = @state.invitee

    if invitee.length and not (util.isEmail(invitee) or util.isMobile(invitee))
      notifyActions.error l('room-members-invalid')
    else if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else if @getUniqueInvitations().some((x) -> invitee in [x.get('email'), x.get('phoneForLogin')])
      notifyActions.error l('room-members-exists')
    else
      if util.isEmail invitee
        Invitee = email: invitee
      else if util.isMobile invitee
        Invitee = mobile: invitee
      if Invitee?
        teamActions.teamInvite @props._teamId, Invitee,
          =>
            @setState invitee: ''

            if @props.contacts.some((x) -> invitee in [x.get('email'), x.get('mobile')])
              notifyActions.success l('room-members-added')


Response:
else if @getUniqueInvitations().some((x) -> invitee in [x.get('email'), x.get('mobile')])
              notifyActions.success l('room-members-invited')
            else
              notifyActions.success l('room-members-success')
          ->
            notifyActions.error l('room-members-error')

  onLinkClick: (event) ->
    event.target.select()

  onInviteChange: (event) ->
    invitee = event.target.value
    @setState {invitee}

  onInviteKeydown: (event) ->
    if event.keyCode is keyboard.enter
      event.preventDefault()
      @sendInvite()

  renderInviteForm: ->
    div className: 'section',
      span className: 'flex-horiz flex-between',
        l('invite-people')
        span className: 'flex-horiz flex-vcenter line', onClick: @props.onBatchInviteClick,
          span className: 'muted', l('or')
          span className: 'button is-link', l('team-contacts-batch-invite-link')
      div className: 'anotated-input',
        input
          type: 'text'
          value: @state.invitee, onKeyDown: @onInviteKeydown
          className: 'form-control'
          placeholder: l('enter-mobile-or-email')
          autoFocus: true
          onChange: @onInviteChange

  render: ->
    div className: 'team-invite',
      @renderInviteForm()
      div className: 'section',
        l('team-contacts-link')
        div className: 'anotated-input',
          input
            type: 'text', className: 'team-contacts-link form-control'
            value: @state.team.get('inviteUrl'), onChange: (->), onClick: @onLinkClick
          ResetInviteUrlPermission
            _teamId: @props._teamId
      div className: 'footer',
        span className: 'button', onClick: @sendInvite, l('team-contacts-do')

ResetInviteUrlClass = React.createClass


Prompt:
else if @getUniqueInvitations().some((x) -> invitee in [x.get('email'), x.get('mobile')])
              notifyActions.success l('room-members-invited')
            else
              notifyActions.success l('room-members-success')
          ->
            notifyActions.error l('room-members-error')

  onLinkClick: (event) ->
    event.target.select()

  onInviteChange: (event) ->
    invitee = event.target.value
    @setState {invitee}

  onInviteKeydown: (event) ->
    if event.keyCode is keyboard.enter
      event.preventDefault()
      @sendInvite()

  renderInviteForm: ->
    div className: 'section',
      span className: 'flex-horiz flex-between',
        l('invite-people')
        span className: 'flex-horiz flex-vcenter line', onClick: @props.onBatchInviteClick,
          span className: 'muted', l('or')

Response:
span className: 'button is-link', l('team-contacts-batch-invite-link')
      div className: 'anotated-input',
        input
          type: 'text'
          value: @state.invitee, onKeyDown: @onInviteKeydown
          className: 'form-control'
          placeholder: l('enter-mobile-or-email')
          autoFocus: true
          onChange: @onInviteChange

  render: ->
    div className: 'team-invite',
      @renderInviteForm()
      div className: 'section',
        l('team-contacts-link')
        div className: 'anotated-input',
          input
            type: 'text', className: 'team-contacts-link form-control'
            value: @state.team.get('inviteUrl'), onChange: (->), onClick: @onLinkClick
          ResetInviteUrlPermission
            _teamId: @props._teamId
      div className: 'footer',
        span className: 'button', onClick: @sendInvite, l('team-contacts-do')

ResetInviteUrlClass = React.createClass


Response:
displayName: 'reset-invite-url'

  mixins: [PureRenderMixin]

  propTypes:
    _teamId: T.string.isRequired

  resetUrl: ->
    teamActions.resetInviteUrl @props._teamId

  render: ->
    span className: 'link-icon', onClick: @resetUrl, l('reset')

ResetInviteUrlPermission = React.createFactory Permission.create(ResetInviteUrlClass, Permission.admin)


Prompt:
displayName: 'reset-invite-url'

  mixins: [PureRenderMixin]

  propTypes:
    _teamId: T.string.isRequired

Response:
resetUrl: ->
    teamActions.resetInviteUrl @props._teamId

  render: ->
    span className: 'link-icon', onClick: @resetUrl, l('reset')

ResetInviteUrlPermission = React.createFactory Permission.create(ResetInviteUrlClass, Permission.admin)


Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.start.line).eql 1
        expect(e.start.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.start.line).eql 1
        expect(e.start.column).eql 0


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.start.line).eql 1
        expect(e.start.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.start.line).eql 1
        expect(e.start.column).eql 0
```

Response:
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.build('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.start.line).eql(1);
        return expect(e.start.column).eql(0);
      }
    });
    return it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.build('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.start.line).eql(1);
        return expect(e.start.column).eql(0);
      }
    });
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.build('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.start.line).eql(1);
        return expect(e.start.column).eql(0);
      }
    });
    return it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.build('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.start.line).eql(1);
        return expect(e.start.column).eql(0);
      }
    });
  });
});
```

Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.start.line).eql 1
        expect(e.start.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.start.line).eql 1
        expect(e.start.column).eql 0


Prompt:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'

Response:
expect(e.start.line).eql 1
        expect(e.start.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.start.line).eql 1
        expect(e.start.column).eql 0


Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0
```

Response:
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.build('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    return it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.build('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.build('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    return it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.build('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
  });
});
```

Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0


Prompt:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'

Response:
expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0


Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.build('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.build('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1
```

Response:
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.build('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.build('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    return it('happens with naked JSON objects', function() {
      var e;
      try {
        return js2coffee.build('{a:2}');
      } catch (error) {
        e = error;
        expect(e.description).include('wrap your JSON');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(1);
      }
    });
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.build('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.build('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    return it('happens with naked JSON objects', function() {
      var e;
      try {
        return js2coffee.build('{a:2}');
      } catch (error) {
        e = error;
        expect(e.description).include('wrap your JSON');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(1);
      }
    });
  });
});
```

Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.build('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1


Prompt:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.build('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->

Response:
try
        js2coffee.build('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.build('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1


Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.parse('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.parse('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.parse('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.parse('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.parse('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.parse('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1
```

Response:
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.parse('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.parse('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    return it('happens with naked JSON objects', function() {
      var e;
      try {
        return js2coffee.parse('{a:2}');
      } catch (error) {
        e = error;
        expect(e.description).include('wrap your JSON');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(1);
      }
    });
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
require('./setup');

describe('Unsupported', function() {
  return describe('thowing unsupported errors', function() {
    it('happens for with()', function() {
      var e;
      try {
        return js2coffee.parse('with(x){}');
      } catch (error) {
        e = error;
        expect(e.description).include('is not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    it('happens with labelled statements', function() {
      var e;
      try {
        return js2coffee.parse('a:\nhi');
      } catch (error) {
        e = error;
        expect(e.description).include('Labeled statements are not supported');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(0);
      }
    });
    return it('happens with naked JSON objects', function() {
      var e;
      try {
        return js2coffee.parse('{a:2}');
      } catch (error) {
        e = error;
        expect(e.description).include('wrap your JSON');
        expect(e.lineNumber).eql(1);
        return expect(e.column).eql(1);
      }
    });
  });
});
```

Response:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.parse('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->
      try
        js2coffee.parse('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.parse('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1


Prompt:
require './setup'

describe 'Unsupported', ->
  describe 'thowing unsupported errors', ->
    it 'happens for with()', ->
      try
        js2coffee.parse('with(x){}')
      catch e
        expect(e.description).include 'is not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with labelled statements', ->

Response:
try
        js2coffee.parse('a:\nhi')
      catch e
        expect(e.description).include 'Labeled statements are not supported'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 0

    it 'happens with naked JSON objects', ->
      try
        js2coffee.parse('{a:2}')
      catch e
        expect(e.description).include 'wrap your JSON'
        expect(e.lineNumber).eql 1
        expect(e.column).eql 1


Response:
require './setup'

describe 'Unsupported', ->
  it 'throws unsupported errors for with', ->
    try
      js2coffee.parse('with(x){}')
    catch e
      expect(e.description).include 'is not supported'
      expect(e.lineNumber).eql 1
      expect(e.column).eql 0


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
require './setup'

describe 'Unsupported', ->
  it 'throws unsupported errors for with', ->
    try
      js2coffee.parse('with(x){}')
    catch e
      expect(e.description).include 'is not supported'
      expect(e.lineNumber).eql 1
      expect(e.column).eql 0
```

Response:
require('./setup');

describe('Unsupported', function() {
  return it('throws unsupported errors for with', function() {
    var e;
    try {
      return js2coffee.parse('with(x){}');
    } catch (error) {
      e = error;
      expect(e.description).include('is not supported');
      expect(e.lineNumber).eql(1);
      return expect(e.column).eql(0);
    }
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
require('./setup');

describe('Unsupported', function() {
  return it('throws unsupported errors for with', function() {
    var e;
    try {
      return js2coffee.parse('with(x){}');
    } catch (error) {
      e = error;
      expect(e.description).include('is not supported');
      expect(e.lineNumber).eql(1);
      return expect(e.column).eql(0);
    }
  });
});
```

Response:
require './setup'

describe 'Unsupported', ->
  it 'throws unsupported errors for with', ->
    try
      js2coffee.parse('with(x){}')
    catch e
      expect(e.description).include 'is not supported'
      expect(e.lineNumber).eql 1
      expect(e.column).eql 0


Prompt:
require './setup'

describe 'Unsupported', ->
  it 'throws unsupported errors for with', ->
    try

Response:
js2coffee.parse('with(x){}')
    catch e
      expect(e.description).include 'is not supported'
      expect(e.lineNumber).eql 1
      expect(e.column).eql 0


Response:
module.exports = React.createClass
  displayName: 'about-feedback'
  mixins: [PureRenderMixin]

  # no props

  getInitialState: ->
    text: ''
    email: recorder.getStore().getIn(['user', 'email']) or ''
    isLoading: false

  onChange: (event) ->
    @setState text: event.target.value

  onEmailChange: (event) ->
    @setState email: event.target.value

  onSubmit: ->
    text = @state.text.trim()
    if text.length > 0
      if @state.email
        text += "\n\n回访邮箱: #{@state.email}"
      else
        text += '\n\n没有提供回访邮箱'
      @setState isLoading: false
      user = recorder.getStore().get('user')
      reqwest
        url: config.feedbackUrl
        method: 'post'
        contentType: 'application/json'
        data: JSON.stringify
          authorName: user.get('name')
          title: lang.getText('user-feedback')
          text: util.withMachineInfo(text, recorder.getStore())
        success: (resp) =>
          @setState text: '', isLoading: false
          notifyActions.info lang.getText('feedback-success')
        error: (error) =>
          @setState isLoading: false
          notifyActions.warn "#{lang.getText('api-failed')} #{error.responseText}"

  render: ->
    buttonClass = classnames 'button', 'is-extended', 'is-primary',
      'is-disabled': @state.text.trim().length is 0

    div className: 'about-feedback',
      div className: 'feedback-box lm-content',
        div className: 'form-group',
          div className: 'guide-line', lang.getText('send-us-feedback1')
          if lang.getLang() isnt 'en'


Prompt:
module.exports = React.createClass
  displayName: 'about-feedback'
  mixins: [PureRenderMixin]

  # no props

  getInitialState: ->
    text: ''
    email: recorder.getStore().getIn(['user', 'email']) or ''
    isLoading: false

  onChange: (event) ->
    @setState text: event.target.value

  onEmailChange: (event) ->
    @setState email: event.target.value

  onSubmit: ->
    text = @state.text.trim()
    if text.length > 0
      if @state.email
        text += "\n\n回访邮箱: #{@state.email}"
      else
        text += '\n\n没有提供回访邮箱'
      @setState isLoading: false

Response:
user = recorder.getStore().get('user')
      reqwest
        url: config.feedbackUrl
        method: 'post'
        contentType: 'application/json'
        data: JSON.stringify
          authorName: user.get('name')
          title: lang.getText('user-feedback')
          text: util.withMachineInfo(text, recorder.getStore())
        success: (resp) =>
          @setState text: '', isLoading: false
          notifyActions.info lang.getText('feedback-success')
        error: (error) =>
          @setState isLoading: false
          notifyActions.warn "#{lang.getText('api-failed')} #{error.responseText}"

  render: ->
    buttonClass = classnames 'button', 'is-extended', 'is-primary',
      'is-disabled': @state.text.trim().length is 0

    div className: 'about-feedback',
      div className: 'feedback-box lm-content',
        div className: 'form-group',
          div className: 'guide-line', lang.getText('send-us-feedback1')
          if lang.getLang() isnt 'en'


Response:
div className: 'guide-line',
              span className: 'feedback-mail', lang.getText('feedback-mail')
              a href: url.feedbackUrl, target: '_blank',
                ' 简聊发烧友'
              lang.getText('comma')
              a href: url.issueUrl, target: '_blank',
                'Teambition 简聊反馈项目'
              lang.getText('comma')
              lang.getText('or')
              lang.getText('send-us-feedback2')
          textarea
            className: 'as-content form-control'
            rows: 5
            value: @state.text
            onChange: @onChange
        div className: 'form-group',
          div className: 'guide-line', lang.getText('return-visit-email')
          input
            value: @state.email, onChange: @onEmailChange, type: 'email'
            className: 'form-control'
            placeholder: lang.getText('email')
        div className: 'form-group',
          button className: buttonClass, onClick: @onSubmit, lang.getText('send')


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
div className: 'guide-line',
              span className: 'feedback-mail', lang.getText('feedback-mail')
              a href: url.feedbackUrl, target: '_blank',
                ' 简聊发烧友'
              lang.getText('comma')
              a href: url.issueUrl, target: '_blank',
                'Teambition 简聊反馈项目'
              lang.getText('comma')
              lang.getText('or')
              lang.getText('send-us-feedback2')
          textarea
            className: 'as-content form-control'
            rows: 5
            value: @state.text
            onChange: @onChange
        div className: 'form-group',
          div className: 'guide-line', lang.getText('return-visit-email')
          input
            value: @state.email, onChange: @onEmailChange, type: 'email'
            className: 'form-control'
            placeholder: lang.getText('email')
        div className: 'form-group',
          button className: buttonClass, onClick: @onSubmit, lang.getText('send')
```

Response:
div({
  className: 'guide-line'
}, span({
  className: 'feedback-mail'
}, lang.getText('feedback-mail')), a({
  href: url.feedbackUrl,
  target: '_blank'
}, ' 简聊发烧友'), lang.getText('comma'), a({
  href: url.issueUrl,
  target: '_blank'
}, 'Teambition 简聊反馈项目'), lang.getText('comma'), lang.getText('or'), lang.getText('send-us-feedback2'));

textarea({
  className: 'as-content form-control',
  rows: 5,
  value: this.state.text,
  onChange: this.onChange
});

div({
  className: 'form-group'
}, div({
  className: 'guide-line'
}, lang.getText('return-visit-email')), input({
  value: this.state.email,
  onChange: this.onEmailChange,
  type: 'email',
  className: 'form-control',
  placeholder: lang.getText('email')
}));

div({
  className: 'form-group'
}, button({
  className: buttonClass,
  onClick: this.onSubmit
}, lang.getText('send')));


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
div({
  className: 'guide-line'
}, span({
  className: 'feedback-mail'
}, lang.getText('feedback-mail')), a({
  href: url.feedbackUrl,
  target: '_blank'
}, ' 简聊发烧友'), lang.getText('comma'), a({
  href: url.issueUrl,
  target: '_blank'
}, 'Teambition 简聊反馈项目'), lang.getText('comma'), lang.getText('or'), lang.getText('send-us-feedback2'));

textarea({
  className: 'as-content form-control',
  rows: 5,
  value: this.state.text,
  onChange: this.onChange
});

div({
  className: 'form-group'
}, div({
  className: 'guide-line'
}, lang.getText('return-visit-email')), input({
  value: this.state.email,
  onChange: this.onEmailChange,
  type: 'email',
  className: 'form-control',
  placeholder: lang.getText('email')
}));

div({
  className: 'form-group'
}, button({
  className: buttonClass,
  onClick: this.onSubmit
}, lang.getText('send')));
```

Response:
div className: 'guide-line',
              span className: 'feedback-mail', lang.getText('feedback-mail')
              a href: url.feedbackUrl, target: '_blank',
                ' 简聊发烧友'
              lang.getText('comma')
              a href: url.issueUrl, target: '_blank',
                'Teambition 简聊反馈项目'
              lang.getText('comma')
              lang.getText('or')
              lang.getText('send-us-feedback2')
          textarea
            className: 'as-content form-control'
            rows: 5
            value: @state.text
            onChange: @onChange
        div className: 'form-group',
          div className: 'guide-line', lang.getText('return-visit-email')
          input
            value: @state.email, onChange: @onEmailChange, type: 'email'
            className: 'form-control'
            placeholder: lang.getText('email')
        div className: 'form-group',
          button className: buttonClass, onClick: @onSubmit, lang.getText('send')


Prompt:
div className: 'guide-line',
              span className: 'feedback-mail', lang.getText('feedback-mail')
              a href: url.feedbackUrl, target: '_blank',
                ' 简聊发烧友'
              lang.getText('comma')
              a href: url.issueUrl, target: '_blank',
                'Teambition 简聊反馈项目'
              lang.getText('comma')
              lang.getText('or')
              lang.getText('send-us-feedback2')
          textarea

Response:
className: 'as-content form-control'
            rows: 5
            value: @state.text
            onChange: @onChange
        div className: 'form-group',
          div className: 'guide-line', lang.getText('return-visit-email')
          input
            value: @state.email, onChange: @onEmailChange, type: 'email'
            className: 'form-control'
            placeholder: lang.getText('email')
        div className: 'form-group',
          button className: buttonClass, onClick: @onSubmit, lang.getText('send')


Response:
_ = require 'lodash'

module.exports =
  childrenAtPath: (path, opts = {}) ->
    unless Array.isArray(path)
      path = path.split('/').filter((p) -> p.length > 0)

    path = _.clone(path)
    query = path.shift()
    matches = @children().filter (c) ->
      if opts.caseSensitive
        c.name is query
      else
        c.name.toLowerCase() is query.toLowerCase()

    if path.length is 0
      return matches
    else
      return _.flatten matches.map (m) ->
        m.childrenAtPath(_.clone(path), opts)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require 'lodash'

module.exports =
  childrenAtPath: (path, opts = {}) ->
    unless Array.isArray(path)
      path = path.split('/').filter((p) -> p.length > 0)

    path = _.clone(path)
    query = path.shift()
    matches = @children().filter (c) ->
      if opts.caseSensitive
        c.name is query
      else
        c.name.toLowerCase() is query.toLowerCase()

    if path.length is 0
      return matches
    else
      return _.flatten matches.map (m) ->
        m.childrenAtPath(_.clone(path), opts)
```

Response:
var _;

_ = require('lodash');

module.exports = {
  childrenAtPath: function(path, opts = {}) {
    var matches, query;
    if (!Array.isArray(path)) {
      path = path.split('/').filter(function(p) {
        return p.length > 0;
      });
    }
    path = _.clone(path);
    query = path.shift();
    matches = this.children().filter(function(c) {
      if (opts.caseSensitive) {
        return c.name === query;
      } else {
        return c.name.toLowerCase() === query.toLowerCase();
      }
    });
    if (path.length === 0) {
      return matches;
    } else {
      return _.flatten(matches.map(function(m) {
        return m.childrenAtPath(_.clone(path), opts);
      }));
    }
  }
};


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

_ = require('lodash');

module.exports = {
  childrenAtPath: function(path, opts = {}) {
    var matches, query;
    if (!Array.isArray(path)) {
      path = path.split('/').filter(function(p) {
        return p.length > 0;
      });
    }
    path = _.clone(path);
    query = path.shift();
    matches = this.children().filter(function(c) {
      if (opts.caseSensitive) {
        return c.name === query;
      } else {
        return c.name.toLowerCase() === query.toLowerCase();
      }
    });
    if (path.length === 0) {
      return matches;
    } else {
      return _.flatten(matches.map(function(m) {
        return m.childrenAtPath(_.clone(path), opts);
      }));
    }
  }
};
```

Response:
_ = require 'lodash'

module.exports =
  childrenAtPath: (path, opts = {}) ->
    unless Array.isArray(path)
      path = path.split('/').filter((p) -> p.length > 0)

    path = _.clone(path)
    query = path.shift()
    matches = @children().filter (c) ->
      if opts.caseSensitive
        c.name is query
      else
        c.name.toLowerCase() is query.toLowerCase()

    if path.length is 0
      return matches
    else
      return _.flatten matches.map (m) ->
        m.childrenAtPath(_.clone(path), opts)


Prompt:
_ = require 'lodash'

module.exports =
  childrenAtPath: (path, opts = {}) ->
    unless Array.isArray(path)
      path = path.split('/').filter((p) -> p.length > 0)

    path = _.clone(path)
    query = path.shift()
    matches = @children().filter (c) ->

Response:
if opts.caseSensitive
        c.name is query
      else
        c.name.toLowerCase() is query.toLowerCase()

    if path.length is 0
      return matches
    else
      return _.flatten matches.map (m) ->
        m.childrenAtPath(_.clone(path), opts)


Response:
moment = require 'moment'
request = require 'request'
config = require 'config'
Promise = require 'bluebird'

requestAsync = Promise.promisify request

startDate = moment("2014-05-01")
endDate = moment('2016-03-01')

searchHost = "#{config.searchProtocol}://#{config.searchHost}:#{config.searchPort}"

buildRange = ->
  query:
    range:
      createdAt:
        gte: startDate.startOf('month').format('YYYY-MM-DD')
        lte: startDate.endOf('month').format('YYYY-MM-DD')

checkCount = ->

  month = startDate.startOf('month').format('YYYYMM')

  $monthlyIndexCount = Promise.resolve().then ->
    options =
      method: 'POST'
      url: "#{searchHost}/talk_messages_#{month}/_count"
      json: true
    requestAsync(options).spread (res) -> res?.body?.count or 0

  $rangeIndexCount = Promise.resolve().then ->
    options =
      method: 'POST'
      url: "#{searchHost}/talk_messages_v2/_count"
      json: true
      body: buildRange()
    requestAsync(options).spread (res) -> res?.body?.count or 0

  Promise.all [$monthlyIndexCount, $rangeIndexCount]

  .spread (monthlyIndexCount, rangeIndexCount) ->
    console.log "Month #{month} Indexed #{monthlyIndexCount} Total #{rangeIndexCount}"
    if monthlyIndexCount is rangeIndexCount
      return true
    else return false

  .then (synced) -> Promise.delay(5000).then(checkCount) unless synced

reindex = ->
  month = startDate.startOf('month').format('YYYYMM')