Response:
diffWithScore = (obj1, obj2, options = {}) ->
  type1 = extendedTypeOf obj1
  type2 = extendedTypeOf obj2

  if type1 == type2
    switch type1
      when 'object'
        return objectDiff(obj1, obj2, options)
      when 'array'
        return arrayDiff(obj1, obj2, options)

  if !options.keysOnly
    if obj1 != obj2
      [0, { __old: obj1, __new: obj2 }]
    else
      [100, obj1]
  else
    [100, undefined]


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
diffWithScore = (obj1, obj2, options = {}) ->
  type1 = extendedTypeOf obj1
  type2 = extendedTypeOf obj2

  if type1 == type2
    switch type1
      when 'object'
        return objectDiff(obj1, obj2, options)
      when 'array'
        return arrayDiff(obj1, obj2, options)

  if !options.keysOnly
    if obj1 != obj2
      [0, { __old: obj1, __new: obj2 }]
    else
      [100, obj1]
  else
    [100, undefined]
```

Response:
var diffWithScore;

diffWithScore = function(obj1, obj2, options = {}) {
  var type1, type2;
  type1 = extendedTypeOf(obj1);
  type2 = extendedTypeOf(obj2);
  if (type1 === type2) {
    switch (type1) {
      case 'object':
        return objectDiff(obj1, obj2, options);
      case 'array':
        return arrayDiff(obj1, obj2, options);
    }
  }
  if (!options.keysOnly) {
    if (obj1 !== obj2) {
      return [
        0,
        {
          __old: obj1,
          __new: obj2
        }
      ];
    } else {
      return [100, obj1];
    }
  } else {
    return [100, void 0];
  }
};


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

diffWithScore = function(obj1, obj2, options = {}) {
  var type1, type2;
  type1 = extendedTypeOf(obj1);
  type2 = extendedTypeOf(obj2);
  if (type1 === type2) {
    switch (type1) {
      case 'object':
        return objectDiff(obj1, obj2, options);
      case 'array':
        return arrayDiff(obj1, obj2, options);
    }
  }
  if (!options.keysOnly) {
    if (obj1 !== obj2) {
      return [
        0,
        {
          __old: obj1,
          __new: obj2
        }
      ];
    } else {
      return [100, obj1];
    }
  } else {
    return [100, void 0];
  }
};
```

Response:
diffWithScore = (obj1, obj2, options = {}) ->
  type1 = extendedTypeOf obj1
  type2 = extendedTypeOf obj2

  if type1 == type2
    switch type1
      when 'object'
        return objectDiff(obj1, obj2, options)
      when 'array'
        return arrayDiff(obj1, obj2, options)

  if !options.keysOnly
    if obj1 != obj2
      [0, { __old: obj1, __new: obj2 }]
    else
      [100, obj1]
  else
    [100, undefined]


Prompt:
diffWithScore = (obj1, obj2, options = {}) ->
  type1 = extendedTypeOf obj1
  type2 = extendedTypeOf obj2

  if type1 == type2
    switch type1
      when 'object'
        return objectDiff(obj1, obj2, options)
      when 'array'

Response:
return arrayDiff(obj1, obj2, options)

  if !options.keysOnly
    if obj1 != obj2
      [0, { __old: obj1, __new: obj2 }]
    else
      [100, obj1]
  else
    [100, undefined]


Response:
diff = (obj1, obj2, options = {}) ->
  [score, change] = diffWithScore(obj1, obj2, options)
  return change


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
diff = (obj1, obj2, options = {}) ->
  [score, change] = diffWithScore(obj1, obj2, options)
  return change
```

Response:
var diff;

diff = function(obj1, obj2, options = {}) {
  var change, score;
  [score, change] = diffWithScore(obj1, obj2, options);
  return change;
};


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

diff = function(obj1, obj2, options = {}) {
  var change, score;
  [score, change] = diffWithScore(obj1, obj2, options);
  return change;
};
```

Response:
diff = (obj1, obj2, options = {}) ->
  [score, change] = diffWithScore(obj1, obj2, options)
  return change


Response:
diffScore = (obj1, obj2, options = {}) ->
  [score, change] = diffWithScore(obj1, obj2, options)
  return score


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
diffScore = (obj1, obj2, options = {}) ->
  [score, change] = diffWithScore(obj1, obj2, options)
  return score
```

Response:
var diffScore;

diffScore = function(obj1, obj2, options = {}) {
  var change, score;
  [score, change] = diffWithScore(obj1, obj2, options);
  return score;
};


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

diffScore = function(obj1, obj2, options = {}) {
  var change, score;
  [score, change] = diffWithScore(obj1, obj2, options);
  return score;
};
```

Response:
diffScore = (obj1, obj2, options = {}) ->
  [score, change] = diffWithScore(obj1, obj2, options)
  return score


Response:
module.exports =
class InsertNlJsx
  constructor: (@editor) ->
    @adviseBefore(@editor, 'insertText', @insertText)

  # patched TextEditor::insertText
  # if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
  # then add another newLine and reposition cursor
  insertText: (text, options) =>
    return true unless ( text is "\n" )
    return true if @editor.hasMultipleCursors() # for time being

    cursorBufferPosition = @editor.getCursorBufferPosition()
    return true unless cursorBufferPosition.column > 0
    return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()
    cursorBufferPosition.column--
    return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()
    indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)
    @editor.insertText("\n\n")
    @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }
    @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }
    @editor.moveUp()
    @editor.moveToEndOfLine()
    false

  # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee
  adviseBefore: (object, methodName, advice) ->
    original = object[methodName]
    object[methodName] = (args...) ->
      unless advice.apply(this, args) == false
        original.apply(this, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports =
class InsertNlJsx
  constructor: (@editor) ->
    @adviseBefore(@editor, 'insertText', @insertText)

  # patched TextEditor::insertText
  # if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
  # then add another newLine and reposition cursor
  insertText: (text, options) =>
    return true unless ( text is "\n" )
    return true if @editor.hasMultipleCursors() # for time being

    cursorBufferPosition = @editor.getCursorBufferPosition()
    return true unless cursorBufferPosition.column > 0
    return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()
    cursorBufferPosition.column--
    return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()
    indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)
    @editor.insertText("\n\n")
    @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }
    @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }
    @editor.moveUp()
    @editor.moveToEndOfLine()
    false

  # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee
  adviseBefore: (object, methodName, advice) ->
    original = object[methodName]
    object[methodName] = (args...) ->
      unless advice.apply(this, args) == false
        original.apply(this, args)
```

Response:
var InsertNlJsx;

module.exports = InsertNlJsx = class InsertNlJsx {
  constructor(editor) {
    // patched TextEditor::insertText
    // if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
    // then add another newLine and reposition cursor
    this.insertText = this.insertText.bind(this);
    this.editor = editor;
    this.adviseBefore(this.editor, 'insertText', this.insertText);
  }

  insertText(text, options) {
    var cursorBufferPosition, indentLength;
    if (!(text === "\n")) {
      return true;
    }
    if (this.editor.hasMultipleCursors()) { // for time being
      return true;
    }
    cursorBufferPosition = this.editor.getCursorBufferPosition();
    if (!(cursorBufferPosition.column > 0)) {
      return true;
    }
    if ('JSXEndTagStart' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {
      return true;
    }
    cursorBufferPosition.column--;
    if ('JSXStartTagEnd' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {
      return true;
    }
    indentLength = this.editor.indentationForBufferRow(cursorBufferPosition.row);
    this.editor.insertText("\n\n");
    this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 1, indentLength + 1, {
      preserveLeadingWhitespace: false
    });
    this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 2, indentLength, {
      preserveLeadingWhitespace: false
    });
    this.editor.moveUp();
    this.editor.moveToEndOfLine();
    return false;
  }

  // from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee
  adviseBefore(object, methodName, advice) {
    var original;
    original = object[methodName];
    return object[methodName] = function(...args) {
      if (advice.apply(this, args) !== false) {
        return original.apply(this, args);
      }
    };
  }

};


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

module.exports = InsertNlJsx = class InsertNlJsx {
  constructor(editor) {
    // patched TextEditor::insertText
    // if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
    // then add another newLine and reposition cursor
    this.insertText = this.insertText.bind(this);
    this.editor = editor;
    this.adviseBefore(this.editor, 'insertText', this.insertText);
  }

  insertText(text, options) {
    var cursorBufferPosition, indentLength;
    if (!(text === "\n")) {
      return true;
    }
    if (this.editor.hasMultipleCursors()) { // for time being
      return true;
    }
    cursorBufferPosition = this.editor.getCursorBufferPosition();
    if (!(cursorBufferPosition.column > 0)) {
      return true;
    }
    if ('JSXEndTagStart' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {
      return true;
    }
    cursorBufferPosition.column--;
    if ('JSXStartTagEnd' !== this.editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()) {
      return true;
    }
    indentLength = this.editor.indentationForBufferRow(cursorBufferPosition.row);
    this.editor.insertText("\n\n");
    this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 1, indentLength + 1, {
      preserveLeadingWhitespace: false
    });
    this.editor.setIndentationForBufferRow(cursorBufferPosition.row + 2, indentLength, {
      preserveLeadingWhitespace: false
    });
    this.editor.moveUp();
    this.editor.moveToEndOfLine();
    return false;
  }

  // from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee
  adviseBefore(object, methodName, advice) {
    var original;
    original = object[methodName];
    return object[methodName] = function(...args) {
      if (advice.apply(this, args) !== false) {
        return original.apply(this, args);
      }
    };
  }

};
```

Response:
module.exports =
class InsertNlJsx
  constructor: (@editor) ->
    @adviseBefore(@editor, 'insertText', @insertText)

  # patched TextEditor::insertText
  # if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
  # then add another newLine and reposition cursor
  insertText: (text, options) =>
    return true unless ( text is "\n" )
    return true if @editor.hasMultipleCursors() # for time being

    cursorBufferPosition = @editor.getCursorBufferPosition()
    return true unless cursorBufferPosition.column > 0
    return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()
    cursorBufferPosition.column--
    return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()
    indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)
    @editor.insertText("\n\n")
    @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }
    @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }
    @editor.moveUp()
    @editor.moveToEndOfLine()
    false

  # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee
  adviseBefore: (object, methodName, advice) ->
    original = object[methodName]
    object[methodName] = (args...) ->
      unless advice.apply(this, args) == false
        original.apply(this, args)


Prompt:
module.exports =
class InsertNlJsx
  constructor: (@editor) ->
    @adviseBefore(@editor, 'insertText', @insertText)

  # patched TextEditor::insertText
  # if a newLine is entered between a JSX tag open and close marked_ <div>_</div>
  # then add another newLine and reposition cursor
  insertText: (text, options) =>
    return true unless ( text is "\n" )
    return true if @editor.hasMultipleCursors() # for time being

    cursorBufferPosition = @editor.getCursorBufferPosition()
    return true unless cursorBufferPosition.column > 0
    return true unless 'JSXEndTagStart' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()

Response:
cursorBufferPosition.column--
    return true unless 'JSXStartTagEnd' is @editor.scopeDescriptorForBufferPosition(cursorBufferPosition).getScopesArray().pop()
    indentLength = @editor.indentationForBufferRow(cursorBufferPosition.row)
    @editor.insertText("\n\n")
    @editor.setIndentationForBufferRow cursorBufferPosition.row+1, indentLength+1, { preserveLeadingWhitespace: false }
    @editor.setIndentationForBufferRow cursorBufferPosition.row+2, indentLength, { preserveLeadingWhitespace: false }
    @editor.moveUp()
    @editor.moveToEndOfLine()
    false

  # from https://github.com/atom/underscore-plus/blob/master/src/underscore-plus.coffee
  adviseBefore: (object, methodName, advice) ->
    original = object[methodName]
    object[methodName] = (args...) ->
      unless advice.apply(this, args) == false
        original.apply(this, args)


Response:
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"
  executables: [
    {
      name: "Dfmt"
      cmd: "dfmt"
      homepage: "https://github.com/Hackerpilot/dfmt"
      installation: "https://github.com/dlang-community/dfmt#building"
    }
  ]

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @exe("dfmt").run([
      @tempFile("input", text)
      ])


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"
  executables: [
    {
      name: "Dfmt"
      cmd: "dfmt"
      homepage: "https://github.com/Hackerpilot/dfmt"
      installation: "https://github.com/dlang-community/dfmt#building"
    }
  ]

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @exe("dfmt").run([
      @tempFile("input", text)
      ])
```

Response:
/*
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
*/
"use strict";
var Beautifier, Dfmt;

Beautifier = require('./beautifier');

module.exports = Dfmt = (function() {
  class Dfmt extends Beautifier {
    beautify(text, language, options) {
      return this.exe("dfmt").run([this.tempFile("input", text)]);
    }

  };

  Dfmt.prototype.name = "dfmt";

  Dfmt.prototype.link = "https://github.com/Hackerpilot/dfmt";

  Dfmt.prototype.executables = [
    {
      name: "Dfmt",
      cmd: "dfmt",
      homepage: "https://github.com/Hackerpilot/dfmt",
      installation: "https://github.com/dlang-community/dfmt#building"
    }
  ];

  Dfmt.prototype.options = {
    D: false
  };

  return Dfmt;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
*/
"use strict";
var Beautifier, Dfmt;

Beautifier = require('./beautifier');

module.exports = Dfmt = (function() {
  class Dfmt extends Beautifier {
    beautify(text, language, options) {
      return this.exe("dfmt").run([this.tempFile("input", text)]);
    }

  };

  Dfmt.prototype.name = "dfmt";

  Dfmt.prototype.link = "https://github.com/Hackerpilot/dfmt";

  Dfmt.prototype.executables = [
    {
      name: "Dfmt",
      cmd: "dfmt",
      homepage: "https://github.com/Hackerpilot/dfmt",
      installation: "https://github.com/dlang-community/dfmt#building"
    }
  ];

  Dfmt.prototype.options = {
    D: false
  };

  return Dfmt;

}).call(this);
```

Response:
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"
  executables: [
    {
      name: "Dfmt"
      cmd: "dfmt"
      homepage: "https://github.com/Hackerpilot/dfmt"
      installation: "https://github.com/dlang-community/dfmt#building"
    }
  ]

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @exe("dfmt").run([
      @tempFile("input", text)
      ])


Prompt:
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"
  executables: [
    {
      name: "Dfmt"
      cmd: "dfmt"

Response:
homepage: "https://github.com/Hackerpilot/dfmt"
      installation: "https://github.com/dlang-community/dfmt#building"
    }
  ]

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @exe("dfmt").run([
      @tempFile("input", text)
      ])


Response:
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"
  isPreInstalled: false

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @run("dfmt", [
      @tempFile("input", text)
      ])


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"
  isPreInstalled: false

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @run("dfmt", [
      @tempFile("input", text)
      ])
```

Response:
/*
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
*/
"use strict";
var Beautifier, Dfmt;

Beautifier = require('./beautifier');

module.exports = Dfmt = (function() {
  class Dfmt extends Beautifier {
    beautify(text, language, options) {
      return this.run("dfmt", [this.tempFile("input", text)]);
    }

  };

  Dfmt.prototype.name = "dfmt";

  Dfmt.prototype.link = "https://github.com/Hackerpilot/dfmt";

  Dfmt.prototype.isPreInstalled = false;

  Dfmt.prototype.options = {
    D: false
  };

  return Dfmt;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
/*
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
*/
"use strict";
var Beautifier, Dfmt;

Beautifier = require('./beautifier');

module.exports = Dfmt = (function() {
  class Dfmt extends Beautifier {
    beautify(text, language, options) {
      return this.run("dfmt", [this.tempFile("input", text)]);
    }

  };

  Dfmt.prototype.name = "dfmt";

  Dfmt.prototype.link = "https://github.com/Hackerpilot/dfmt";

  Dfmt.prototype.isPreInstalled = false;

  Dfmt.prototype.options = {
    D: false
  };

  return Dfmt;

}).call(this);
```

Response:
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"
  isPreInstalled: false

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @run("dfmt", [
      @tempFile("input", text)
      ])


Prompt:
###
Requires [dfmt](https://github.com/Hackerpilot/dfmt)
###
"use strict"
Beautifier = require('./beautifier')

module.exports = class Dfmt extends Beautifier
  name: "dfmt"
  link: "https://github.com/Hackerpilot/dfmt"

Response:
isPreInstalled: false

  options: {
    D: false
  }

  beautify: (text, language, options) ->
    @run("dfmt", [
      @tempFile("input", text)
      ])


Response:
{Promise} = require "rsvp"

Promise::done = (done) -> @then done
Promise::fail = (fail) -> @then null, fail

module.exports = -> new Promise()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
{Promise} = require "rsvp"

Promise::done = (done) -> @then done
Promise::fail = (fail) -> @then null, fail

module.exports = -> new Promise()
```

Response:
var Promise;

({Promise} = require("rsvp"));

Promise.prototype.done = function(done) {
  return this.then(done);
};

Promise.prototype.fail = function(fail) {
  return this.then(null, fail);
};

module.exports = function() {
  return new Promise();
};


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

({Promise} = require("rsvp"));

Promise.prototype.done = function(done) {
  return this.then(done);
};

Promise.prototype.fail = function(fail) {
  return this.then(null, fail);
};

module.exports = function() {
  return new Promise();
};
```

Response:
{Promise} = require "rsvp"

Promise::done = (done) -> @then done
Promise::fail = (fail) -> @then null, fail

module.exports = -> new Promise()


Prompt:
{Promise} = require "rsvp"

Promise::done = (done) -> @then done

Response:
Promise::fail = (fail) -> @then null, fail

module.exports = -> new Promise()


Response:
Promise = require "fantasy-promises"

Promise::done = (done) -> @fork done, null
Promise::fail = (fail) -> @fork null, fail

module.exports = (fork) ->
  new Promise (resolve, reject) ->
    fork (resolve or ->), (reject or ->)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
Promise = require "fantasy-promises"

Promise::done = (done) -> @fork done, null
Promise::fail = (fail) -> @fork null, fail

module.exports = (fork) ->
  new Promise (resolve, reject) ->
    fork (resolve or ->), (reject or ->)
```

Response:
var Promise;

Promise = require("fantasy-promises");

Promise.prototype.done = function(done) {
  return this.fork(done, null);
};

Promise.prototype.fail = function(fail) {
  return this.fork(null, fail);
};

module.exports = function(fork) {
  return new Promise(function(resolve, reject) {
    return fork(resolve || function() {}, reject || function() {});
  });
};


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

Promise = require("fantasy-promises");

Promise.prototype.done = function(done) {
  return this.fork(done, null);
};

Promise.prototype.fail = function(fail) {
  return this.fork(null, fail);
};

module.exports = function(fork) {
  return new Promise(function(resolve, reject) {
    return fork(resolve || function() {}, reject || function() {});
  });
};
```

Response:
Promise = require "fantasy-promises"

Promise::done = (done) -> @fork done, null
Promise::fail = (fail) -> @fork null, fail

module.exports = (fork) ->
  new Promise (resolve, reject) ->
    fork (resolve or ->), (reject or ->)


Prompt:
Promise = require "fantasy-promises"

Promise::done = (done) -> @fork done, null
Promise::fail = (fail) -> @fork null, fail

Response:
module.exports = (fork) ->
  new Promise (resolve, reject) ->
    fork (resolve or ->), (reject or ->)


Response:
suite 'Text Guards:', ->
  test 'constructor', ->
    err(
      () -> xml('test').txt()
      Error
      "Missing element text. parent: <test>"
    )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
suite 'Text Guards:', ->
  test 'constructor', ->
    err(
      () -> xml('test').txt()
      Error
      "Missing element text. parent: <test>"
    )
```

Response:
suite('Text Guards:', function() {
  return test('constructor', function() {
    return err(function() {
      return xml('test').txt();
    }, Error, "Missing element text. parent: <test>");
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
suite('Text Guards:', function() {
  return test('constructor', function() {
    return err(function() {
      return xml('test').txt();
    }, Error, "Missing element text. parent: <test>");
  });
});
```

Response:
suite 'Text Guards:', ->
  test 'constructor', ->
    err(
      () -> xml('test').txt()
      Error
      "Missing element text. parent: <test>"
    )


Prompt:
suite 'Text Guards:', ->
  test 'constructor', ->
    err(

Response:
() -> xml('test').txt()
      Error
      "Missing element text. parent: <test>"
    )


Response:
# The **Scope** class regulates lexical scoping within CoffeeScript. As you
# generate code, you create a tree of scopes in the same shape as the nested
# function bodies. Each scope knows about the variables declared within it,
# and has a reference to its parent enclosing scope. In this way, we know which
# variables are new and need to be declared with `var`, and which are shared
# with the outside.

# Set up exported variables for both **Node.js** and the browser.
this.exports: this unless process?

exports.Scope: class Scope

  # The top-level **Scope** object.
  @root: null

  # Initialize a scope with its parent, for lookups up the chain,
  # as well as a reference to the **Expressions** node is belongs to, which is
  # where it should declare its variables, and a reference to the function that
  # it wraps.
  constructor: (parent, expressions, method) ->
    [@parent, @expressions, @method]: [parent, expressions, method]
    @variables: {}
    if @parent
      @temp_var: @parent.temp_var
    else
      Scope.root: this
      @temp_var: '_a'

  # Look up a variable name in lexical scope, and declare it if it does not
  # already exist.
  find: (name) ->
    return true if @check name
    @variables[name]: 'var'
    false

  # Test variables and return true the first time fn(v, k) returns true
  any: (fn) ->
    for v, k of @variables when fn(v, k)
      return true
    return false


Prompt:
# The **Scope** class regulates lexical scoping within CoffeeScript. As you
# generate code, you create a tree of scopes in the same shape as the nested
# function bodies. Each scope knows about the variables declared within it,
# and has a reference to its parent enclosing scope. In this way, we know which
# variables are new and need to be declared with `var`, and which are shared
# with the outside.

# Set up exported variables for both **Node.js** and the browser.
this.exports: this unless process?

exports.Scope: class Scope

  # The top-level **Scope** object.
  @root: null

  # Initialize a scope with its parent, for lookups up the chain,
  # as well as a reference to the **Expressions** node is belongs to, which is
  # where it should declare its variables, and a reference to the function that
  # it wraps.
  constructor: (parent, expressions, method) ->

Response:
[@parent, @expressions, @method]: [parent, expressions, method]
    @variables: {}
    if @parent
      @temp_var: @parent.temp_var
    else
      Scope.root: this
      @temp_var: '_a'

  # Look up a variable name in lexical scope, and declare it if it does not
  # already exist.
  find: (name) ->
    return true if @check name
    @variables[name]: 'var'
    false

  # Test variables and return true the first time fn(v, k) returns true
  any: (fn) ->
    for v, k of @variables when fn(v, k)
      return true
    return false


Response:
# Reserve a variable name as originating from a function parameter for this
  # scope. No `var` required for internal references.
  parameter: (name) ->
    @variables[name]: 'param'

  # Just check to see if a variable has already been declared, without reserving.
  check: (name) ->
    return true if @variables[name]
    !!(@parent and @parent.check(name))

  # If we need to store an intermediate result, find an available name for a
  # compiler-generated variable. `_a`, `_b`, and so on...
  free_variable: ->
    while @check @temp_var
      ordinal: 1 + parseInt @temp_var.substr(1), 36
      @temp_var: '_' + ordinal.toString(36).replace(/\d/g, 'a')
    @variables[@temp_var]: 'var'
    @temp_var

  # Ensure that an assignment is made at the top of this scope
  # (or at the top-level scope, if requested).
  assign: (name, value) ->
    @variables[name]: {value: value, assigned: true}

  # Does this scope reference any variables that need to be declared in the
  # given function body?
  has_declarations: (body) ->
    body is @expressions and @any (k, val) -> val is 'var'

  # Does this scope reference any assignments that need to be declared at the
  # top of the given function body?
  has_assignments: (body) ->
    body is @expressions and @any (k, val) -> val.assigned

  # Return the list of variables first declared in this scope.
  declared_variables: ->
    (key for key, val of @variables when val is 'var').sort()

  # Return the list of assignments that are supposed to be made at the top
  # of this scope.
  assigned_variables: ->
    "$key = $val.value" for key, val of @variables when val.assigned


Prompt:
# Reserve a variable name as originating from a function parameter for this
  # scope. No `var` required for internal references.
  parameter: (name) ->
    @variables[name]: 'param'

  # Just check to see if a variable has already been declared, without reserving.
  check: (name) ->
    return true if @variables[name]
    !!(@parent and @parent.check(name))

  # If we need to store an intermediate result, find an available name for a
  # compiler-generated variable. `_a`, `_b`, and so on...
  free_variable: ->
    while @check @temp_var
      ordinal: 1 + parseInt @temp_var.substr(1), 36
      @temp_var: '_' + ordinal.toString(36).replace(/\d/g, 'a')
    @variables[@temp_var]: 'var'
    @temp_var

  # Ensure that an assignment is made at the top of this scope
  # (or at the top-level scope, if requested).

Response:
assign: (name, value) ->
    @variables[name]: {value: value, assigned: true}

  # Does this scope reference any variables that need to be declared in the
  # given function body?
  has_declarations: (body) ->
    body is @expressions and @any (k, val) -> val is 'var'

  # Does this scope reference any assignments that need to be declared at the
  # top of the given function body?
  has_assignments: (body) ->
    body is @expressions and @any (k, val) -> val.assigned

  # Return the list of variables first declared in this scope.
  declared_variables: ->
    (key for key, val of @variables when val is 'var').sort()

  # Return the list of assignments that are supposed to be made at the top
  # of this scope.
  assigned_variables: ->
    "$key = $val.value" for key, val of @variables when val.assigned


Response:
# Compile the JavaScript for all of the variable declarations in this scope.
  compiled_declarations: ->
    @declared_variables().join ', '

  # Compile the JavaScript for all of the variable assignments in this scope.
  compiled_assignments: ->
    @assigned_variables().join ', '


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# Compile the JavaScript for all of the variable declarations in this scope.
  compiled_declarations: ->
    @declared_variables().join ', '

  # Compile the JavaScript for all of the variable assignments in this scope.
  compiled_assignments: ->
    @assigned_variables().join ', '
```

Response:
// Compile the JavaScript for all of the variable declarations in this scope.
({
  compiled_declarations: function() {
    return this.declared_variables().join(', ');
  },
  // Compile the JavaScript for all of the variable assignments in this scope.
  compiled_assignments: function() {
    return this.assigned_variables().join(', ');
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// Compile the JavaScript for all of the variable declarations in this scope.
({
  compiled_declarations: function() {
    return this.declared_variables().join(', ');
  },
  // Compile the JavaScript for all of the variable assignments in this scope.
  compiled_assignments: function() {
    return this.assigned_variables().join(', ');
  }
});
```

Response:
# Compile the JavaScript for all of the variable declarations in this scope.
  compiled_declarations: ->
    @declared_variables().join ', '

  # Compile the JavaScript for all of the variable assignments in this scope.
  compiled_assignments: ->
    @assigned_variables().join ', '


Prompt:
# Compile the JavaScript for all of the variable declarations in this scope.
  compiled_declarations: ->
    @declared_variables().join ', '

Response:
# Compile the JavaScript for all of the variable assignments in this scope.
  compiled_assignments: ->
    @assigned_variables().join ', '


Response:
express = require 'express'

module.exports = app = express()

app.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'


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

module.exports = app = express()

app.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'
```

Response:
var app, express;

express = require('express');

module.exports = app = express();

app.post('/messages', function(req, res) {
  return res.send({
    content: 'ok',
    authorName: '小艾'
  });
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var app, express;

express = require('express');

module.exports = app = express();

app.post('/messages', function(req, res) {
  return res.send({
    content: 'ok',
    authorName: '小艾'
  });
});
```

Response:
express = require 'express'

module.exports = app = express()

app.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'


Prompt: express = require 'express'

Response:
module.exports = app = express()

app.post '/messages', (req, res) -> res.send content: 'ok', authorName: '小艾'


Response:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin
  ### A template plugin subclass have to implement a `render` instance method and a `fromFile` class method. ###

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile filepath, (error, template) ->
        error.message = "template #{ filepath.relative }: #{ error.message }" if error?
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [


Prompt:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin
  ### A template plugin subclass have to implement a `render` instance method and a `fromFile` class method. ###

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

Response:
templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile filepath, (error, template) ->
        error.message = "template #{ filepath.relative }: #{ error.message }" if error?
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [


Response:
(callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

### Exports ###

module.exports = {TemplatePlugin, loadTemplates}


Prompt:
(callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

Response:
### Exports ###

module.exports = {TemplatePlugin, loadTemplates}


Response:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile filepath, (error, template) ->
        error.message = "template #{ filepath.relative }: #{ error.message }" if error?
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback


Prompt:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

Response:
resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile filepath, (error, template) ->
        error.message = "template #{ filepath.relative }: #{ error.message }" if error?
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback


Response:
resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

### Exports ###

module.exports = {TemplatePlugin, loadTemplates}


Prompt:
resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

Response:
### Exports ###

module.exports = {TemplatePlugin, loadTemplates}


Response:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames


Prompt:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

Response:
resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames


Response:
(filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

### Exports ###

module.exports = {TemplatePlugin, loadTemplates}


Prompt:
(filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

Response:
### Exports ###

module.exports = {TemplatePlugin, loadTemplates}


Response:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (env, filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile env, filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames


Prompt:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend, readdirRecursive} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (env, filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

Response:
resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
      callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile env, filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames


Response:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (env, filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

readdirRecursive = (directory, callback) ->
  ### Returns an array representing *directory*, including subdirectories. ###
  result = []
  walk = (dir, callback) ->
    async.waterfall [
      async.apply fs.readdir, path.join(directory, dir)
      (filenames, callback) ->
        async.forEach filenames, (filename, callback) ->
          relname = path.join dir, filename
          async.waterfall [
            async.apply fs.stat, path.join(directory, relname)
            (stat, callback) ->
              if stat.isDirectory()
                walk relname, callback
              else
                result.push relname
                callback()
          ], callback
        , callback
    ], callback
  walk '', (error) -> callback error, result

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (env, filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

readdirRecursive = (directory, callback) ->
  ### Returns an array representing *directory*, including subdirectories. ###
  result = []
  walk = (dir, callback) ->
    async.waterfall [
      async.apply fs.readdir, path.join(directory, dir)
      (filenames, callback) ->
        async.forEach filenames, (filename, callback) ->
          relname = path.join dir, filename
          async.waterfall [
            async.apply fs.stat, path.join(directory, relname)
            (stat, callback) ->
              if stat.isDirectory()
                walk relname, callback
              else
                result.push relname
                callback()
          ], callback
        , callback
    ], callback
  walk '', (error) -> callback error, result

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->
```

Response:
/* templates.coffee */
var TemplatePlugin, async, extend, fs, loadTemplates, minimatch, path, readdirRecursive;

async = require('async');

fs = require('fs');

minimatch = require('minimatch');

path = require('path');

({extend} = require('./utils'));

TemplatePlugin = class TemplatePlugin {
  render(locals, callback) {
    /* Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. */
    throw new Error('Not implemented.');
  }

};

TemplatePlugin.fromFile = function(env, filepath, callback) {
  /* *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
       an object containing the full and relative (to templates directory) path to the file. */
  throw new Error('Not implemented.');
};

readdirRecursive = function(directory, callback) {
  /* Returns an array representing *directory*, including subdirectories. */
  var result, walk;
  result = [];
  walk = function(dir, callback) {
    return async.waterfall([
      async.apply(fs.readdir,
      path.join(directory,
      dir)),
      function(filenames,
      callback) {
        return async.forEach(filenames,
      function(filename,
      callback) {
          var relname;
          relname = path.join(dir,
      filename);
          return async.waterfall([
            async.apply(fs.stat,
            path.join(directory,
            relname)),
            function(stat,
            callback) {
              if (stat.isDirectory()) {
                return walk(relname,
            callback);
              } else {
                result.push(relname);
                return callback();
              }
            }
          ],
      callback);
        },
      callback);
      }
    ], callback);
  };
  return walk('', function(error) {
    return callback(error, result);
  });
};

loadTemplates = function(env, callback) {
  /* Load and any templates associated with the environment *env*. Calls *callback* with
       a map of templates as {<filename>: <TemplatePlugin instance>} */
  var resolveFilenames, templates;
  templates = {};
  return resolveFilenames = function(filenames, callback) {
    return async.map(filenames, function(filename, callback) {});
  };
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
/* templates.coffee */
var TemplatePlugin, async, extend, fs, loadTemplates, minimatch, path, readdirRecursive;

async = require('async');

fs = require('fs');

minimatch = require('minimatch');

path = require('path');

({extend} = require('./utils'));

TemplatePlugin = class TemplatePlugin {
  render(locals, callback) {
    /* Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. */
    throw new Error('Not implemented.');
  }

};

TemplatePlugin.fromFile = function(env, filepath, callback) {
  /* *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
       an object containing the full and relative (to templates directory) path to the file. */
  throw new Error('Not implemented.');
};

readdirRecursive = function(directory, callback) {
  /* Returns an array representing *directory*, including subdirectories. */
  var result, walk;
  result = [];
  walk = function(dir, callback) {
    return async.waterfall([
      async.apply(fs.readdir,
      path.join(directory,
      dir)),
      function(filenames,
      callback) {
        return async.forEach(filenames,
      function(filename,
      callback) {
          var relname;
          relname = path.join(dir,
      filename);
          return async.waterfall([
            async.apply(fs.stat,
            path.join(directory,
            relname)),
            function(stat,
            callback) {
              if (stat.isDirectory()) {
                return walk(relname,
            callback);
              } else {
                result.push(relname);
                return callback();
              }
            }
          ],
      callback);
        },
      callback);
      }
    ], callback);
  };
  return walk('', function(error) {
    return callback(error, result);
  });
};

loadTemplates = function(env, callback) {
  /* Load and any templates associated with the environment *env*. Calls *callback* with
       a map of templates as {<filename>: <TemplatePlugin instance>} */
  var resolveFilenames, templates;
  templates = {};
  return resolveFilenames = function(filenames, callback) {
    return async.map(filenames, function(filename, callback) {});
  };
};
```

Response:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (env, filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

readdirRecursive = (directory, callback) ->
  ### Returns an array representing *directory*, including subdirectories. ###
  result = []
  walk = (dir, callback) ->
    async.waterfall [
      async.apply fs.readdir, path.join(directory, dir)
      (filenames, callback) ->
        async.forEach filenames, (filename, callback) ->
          relname = path.join dir, filename
          async.waterfall [
            async.apply fs.stat, path.join(directory, relname)
            (stat, callback) ->
              if stat.isDirectory()
                walk relname, callback
              else
                result.push relname
                callback()
          ], callback
        , callback
    ], callback
  walk '', (error) -> callback error, result

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->


Prompt:
### templates.coffee ###

async = require 'async'
fs = require 'fs'
minimatch = require 'minimatch'
path = require 'path'

{extend} = require './utils'

class TemplatePlugin

  render: (locals, callback) ->
    ### Render template using *locals* and *callback* with a ReadStream or Buffer containing the result. ###
    throw new Error 'Not implemented.'

TemplatePlugin.fromFile = (env, filepath, callback) ->
  ### *callback* with a instance of <TemplatePlugin> created from *filepath*. Where *filepath* is
      an object containing the full and relative (to templates directory) path to the file. ###
  throw new Error 'Not implemented.'

readdirRecursive = (directory, callback) ->
  ### Returns an array representing *directory*, including subdirectories. ###
  result = []
  walk = (dir, callback) ->
    async.waterfall [

Response:
async.apply fs.readdir, path.join(directory, dir)
      (filenames, callback) ->
        async.forEach filenames, (filename, callback) ->
          relname = path.join dir, filename
          async.waterfall [
            async.apply fs.stat, path.join(directory, relname)
            (stat, callback) ->
              if stat.isDirectory()
                walk relname, callback
              else
                result.push relname
                callback()
          ], callback
        , callback
    ], callback
  walk '', (error) -> callback error, result

loadTemplates = (env, callback) ->
  ### Load and any templates associated with the environment *env*. Calls *callback* with
      a map of templates as {<filename>: <TemplatePlugin instance>} ###

  templates = {}

  resolveFilenames = (filenames, callback) ->
    async.map filenames, (filename, callback) ->


Response:
callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile env, filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

module.exports.loadTemplates = loadTemplates
module.exports.TemplatePlugin = TemplatePlugin


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile env, filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

module.exports.loadTemplates = loadTemplates
module.exports.TemplatePlugin = TemplatePlugin
```

Response:
var loadTemplate;

callback(null, {
  full: path.join(env.templatesPath, filename),
  relative: filename
}, callback);

loadTemplate = function(filepath, callback) {
  /* Create an template plugin instance from *filepath*. */
  var i, j, plugin, ref;
  plugin = null;
  for (i = j = ref = env.templatePlugins.length - 1; j >= 0; i = j += -1) {
    if (minimatch(filepath.relative, env.templatePlugins[i].pattern)) {
      plugin = env.templatePlugins[i];
      break;
    }
  }
  if (plugin != null) {
    return plugin.class.fromFile(env, filepath, function(error, template) {
      templates[filepath.relative] = template;
      return callback(error);
    });
  } else {
    return callback();
  }
};

async.waterfall([
  function(callback) {
    return readdirRecursive(env.templatesPath,
  callback);
  },
  resolveFilenames,
  function(filenames,
  callback) {
    return async.forEach(filenames,
  loadTemplate,
  callback);
  }
], function(error) {
  return callback(error, templates);
});

module.exports.loadTemplates = loadTemplates;

module.exports.TemplatePlugin = TemplatePlugin;


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

callback(null, {
  full: path.join(env.templatesPath, filename),
  relative: filename
}, callback);

loadTemplate = function(filepath, callback) {
  /* Create an template plugin instance from *filepath*. */
  var i, j, plugin, ref;
  plugin = null;
  for (i = j = ref = env.templatePlugins.length - 1; j >= 0; i = j += -1) {
    if (minimatch(filepath.relative, env.templatePlugins[i].pattern)) {
      plugin = env.templatePlugins[i];
      break;
    }
  }
  if (plugin != null) {
    return plugin.class.fromFile(env, filepath, function(error, template) {
      templates[filepath.relative] = template;
      return callback(error);
    });
  } else {
    return callback();
  }
};

async.waterfall([
  function(callback) {
    return readdirRecursive(env.templatesPath,
  callback);
  },
  resolveFilenames,
  function(filenames,
  callback) {
    return async.forEach(filenames,
  loadTemplate,
  callback);
  }
], function(error) {
  return callback(error, templates);
});

module.exports.loadTemplates = loadTemplates;

module.exports.TemplatePlugin = TemplatePlugin;
```

Response:
callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?
      plugin.class.fromFile env, filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

module.exports.loadTemplates = loadTemplates
module.exports.TemplatePlugin = TemplatePlugin


Prompt:
callback null,
        full: path.join env.templatesPath, filename
        relative: filename
    , callback

  loadTemplate = (filepath, callback) ->
    ### Create an template plugin instance from *filepath*. ###
    plugin = null
    for i in [env.templatePlugins.length - 1..0] by -1
      if minimatch filepath.relative, env.templatePlugins[i].pattern
        plugin = env.templatePlugins[i]
        break
    if plugin?

Response:
plugin.class.fromFile env, filepath, (error, template) ->
        templates[filepath.relative] = template
        callback error
    else
      callback()

  async.waterfall [
    (callback) -> readdirRecursive env.templatesPath, callback
    resolveFilenames
    (filenames, callback) -> async.forEach filenames, loadTemplate, callback
  ], (error) -> callback error, templates

module.exports.loadTemplates = loadTemplates
module.exports.TemplatePlugin = TemplatePlugin


Response:
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    try
      process.chdir location
    catch error
      awkward.log chalk.red 'No such directory!'
      return
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    try
      process.chdir location
    catch error
      awkward.log chalk.red 'No such directory!'
      return
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command
```

Response:
module.exports = function(command) {
  var error, location, ref;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;
    try {
      process.chdir(location);
    } catch (error1) {
      error = error1;
      awkward.log(chalk.red('No such directory!'));
      return;
    }
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  return (require('./core'))(command);
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function(command) {
  var error, location, ref;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;
    try {
      process.chdir(location);
    } catch (error1) {
      error = error1;
      awkward.log(chalk.red('No such directory!'));
      return;
    }
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  return (require('./core'))(command);
};
```

Response:
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    try
      process.chdir location
    catch error
      awkward.log chalk.red 'No such directory!'
      return
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command


Prompt:
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    try

Response:
process.chdir location
    catch error
      awkward.log chalk.red 'No such directory!'
      return
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command


Response:
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command
```

Response:
module.exports = function(command) {
  var location, ref;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;
    process.chdir(location);
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  return (require('./core'))(command);
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function(command) {
  var location, ref;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;
    process.chdir(location);
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  return (require('./core'))(command);
};
```

Response:
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command


Prompt:
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'

Response:
location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return

  (require './core') command


Response:
child_process = require 'child_process'

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )


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

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )
```

Response:
var child_process, exec;

child_process = require('child_process');

exec = child_process.exec;

module.exports = function(command) {
  var cp, location, ref;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;
    process.chdir(location);
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  cp = exec(command, function(e, r, b) {
    if (e) {
      awkward.log(chalk.red(e));
    }
  });
  return cp.stdout.on('data', function(data) {
    awkward.log('');
    return awkward.log(data);
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var child_process, exec;

child_process = require('child_process');

exec = child_process.exec;

module.exports = function(command) {
  var cp, location, ref;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (ref = command.split(' ')[1]) != null ? ref : '/home/' + process.env.USER;
    process.chdir(location);
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  cp = exec(command, function(e, r, b) {
    if (e) {
      awkward.log(chalk.red(e));
    }
  });
  return cp.stdout.on('data', function(data) {
    awkward.log('');
    return awkward.log(data);
  });
};
```

Response:
child_process = require 'child_process'

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )


Prompt:
child_process = require 'child_process'

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = command.split(' ')[1] ? '/home/'+process.env.USER
    process.chdir location

Response:
awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )


Response:
child_process = require 'child_process'

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = ((loc)->
      loc = loc.split(' ')[1]
      if loc
        loc
      else
        '/home/'+process.env.USER
      )(command)
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )


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

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = ((loc)->
      loc = loc.split(' ')[1]
      if loc
        loc
      else
        '/home/'+process.env.USER
      )(command)
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )
```

Response:
var child_process, exec;

child_process = require('child_process');

exec = child_process.exec;

module.exports = function(command) {
  var cp, location;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (function(loc) {
      loc = loc.split(' ')[1];
      if (loc) {
        return loc;
      } else {
        return '/home/' + process.env.USER;
      }
    })(command);
    process.chdir(location);
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  cp = exec(command, function(e, r, b) {
    if (e) {
      awkward.log(chalk.red(e));
    }
  });
  return cp.stdout.on('data', function(data) {
    awkward.log('');
    return awkward.log(data);
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var child_process, exec;

child_process = require('child_process');

exec = child_process.exec;

module.exports = function(command) {
  var cp, location;
  if (!command) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  if ((command.indexOf('cd ')) > -1 || command === 'cd') {
    location = (function(loc) {
      loc = loc.split(' ')[1];
      if (loc) {
        return loc;
      } else {
        return '/home/' + process.env.USER;
      }
    })(command);
    process.chdir(location);
    awkward.log(chalk.green(`Changed directory to ${location}`));
    return;
  }
  cp = exec(command, function(e, r, b) {
    if (e) {
      awkward.log(chalk.red(e));
    }
  });
  return cp.stdout.on('data', function(data) {
    awkward.log('');
    return awkward.log(data);
  });
};
```

Response:
child_process = require 'child_process'

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = ((loc)->
      loc = loc.split(' ')[1]
      if loc
        loc
      else
        '/home/'+process.env.USER
      )(command)
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )


Prompt:
child_process = require 'child_process'

exec = child_process.exec
module.exports = (command)->
  if !command
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  if (command.indexOf 'cd ') > -1 or command is 'cd'
    location = ((loc)->
      loc = loc.split(' ')[1]
      if loc
        loc
      else

Response:
'/home/'+process.env.USER
      )(command)
    process.chdir location
    awkward.log chalk.green "Changed directory to #{location}"
    return
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log ''
    awkward.log data
    )


Response:
child_process = require 'child_process'
exec = child_process.exec
module.exports = (words)->
  if !words
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  command = words.join ' '
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log data
    )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
child_process = require 'child_process'
exec = child_process.exec
module.exports = (words)->
  if !words
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  command = words.join ' '
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log data
    )
```

Response:
var child_process, exec;

child_process = require('child_process');

exec = child_process.exec;

module.exports = function(words) {
  var command, cp;
  if (!words) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  command = words.join(' ');
  cp = exec(command, function(e, r, b) {
    if (e) {
      awkward.log(chalk.red(e));
    }
  });
  return cp.stdout.on('data', function(data) {
    return awkward.log(data);
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var child_process, exec;

child_process = require('child_process');

exec = child_process.exec;

module.exports = function(words) {
  var command, cp;
  if (!words) {
    awkward.log(chalk.green('Well that\'s awkward!'));
    return;
  }
  command = words.join(' ');
  cp = exec(command, function(e, r, b) {
    if (e) {
      awkward.log(chalk.red(e));
    }
  });
  return cp.stdout.on('data', function(data) {
    return awkward.log(data);
  });
};
```

Response:
child_process = require 'child_process'
exec = child_process.exec
module.exports = (words)->
  if !words
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  command = words.join ' '
  cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log data
    )


Prompt:
child_process = require 'child_process'
exec = child_process.exec
module.exports = (words)->
  if !words
    awkward.log chalk.green 'Well that\'s awkward!'
    return
  command = words.join ' '

Response:
cp = exec(command, (e,r,b)->
    if e
      awkward.log chalk.red e
      return
    )
  cp.stdout.on('data', (data)->
    awkward.log data
    )


Response:
module.exports = React.createClass
  displayName: 'user-corner'
  mixins: [mixinSubscribe]

  propTypes:
    _teamId: T.string.isRequired

  getInitialState: ->
    user: @getUser()
    showMenu: false
    showSettings: false

  componentDidMount: ->
    @_rootEl = @refs.root
    @subscribe recorder, =>
      @setState user: @getUser()

  getUser: ->
    query.user(recorder.getState())

  getBaseArea: ->
    if @_rootEl?
      @_rootEl.getBoundingClientRect()
    else
      {}

  # event handlers

  onAvatarClick: (event) ->
    event.stopPropagation()
    @setState showMenu: (not @state.showMenu)

  onPopoverClose: (event) ->
    @setState showMenu: false

  onSettingsClick: ->
    @setState showSettings: true

  onSettingsClose: ->
    @setState showSettings: false

  onLogoutClick: ->
    userActions.userSignout()

  renderMenu: ->
    LightPopover
      baseArea: if @state.showMenu then @getBaseArea() else {}
      onPopoverClose: @onPopoverClose
      showClose: false
      show: @state.showMenu


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
  displayName: 'user-corner'
  mixins: [mixinSubscribe]

  propTypes:
    _teamId: T.string.isRequired

  getInitialState: ->
    user: @getUser()
    showMenu: false
    showSettings: false

  componentDidMount: ->
    @_rootEl = @refs.root
    @subscribe recorder, =>
      @setState user: @getUser()

  getUser: ->
    query.user(recorder.getState())

  getBaseArea: ->
    if @_rootEl?
      @_rootEl.getBoundingClientRect()
    else
      {}

  # event handlers

  onAvatarClick: (event) ->
    event.stopPropagation()
    @setState showMenu: (not @state.showMenu)

  onPopoverClose: (event) ->
    @setState showMenu: false

  onSettingsClick: ->
    @setState showSettings: true

  onSettingsClose: ->
    @setState showSettings: false

  onLogoutClick: ->
    userActions.userSignout()

  renderMenu: ->
    LightPopover
      baseArea: if @state.showMenu then @getBaseArea() else {}
      onPopoverClose: @onPopoverClose
      showClose: false
      show: @state.showMenu
```

Response:
module.exports = React.createClass({
  displayName: 'user-corner',
  mixins: [mixinSubscribe],
  propTypes: {
    _teamId: T.string.isRequired
  },
  getInitialState: function() {
    return {
      user: this.getUser(),
      showMenu: false,
      showSettings: false
    };
  },
  componentDidMount: function() {
    this._rootEl = this.refs.root;
    return this.subscribe(recorder, () => {
      return this.setState({
        user: this.getUser()
      });
    });
  },
  getUser: function() {
    return query.user(recorder.getState());
  },
  getBaseArea: function() {
    if (this._rootEl != null) {
      return this._rootEl.getBoundingClientRect();
    } else {
      return {};
    }
  },
  // event handlers
  onAvatarClick: function(event) {
    event.stopPropagation();
    return this.setState({
      showMenu: !this.state.showMenu
    });
  },
  onPopoverClose: function(event) {
    return this.setState({
      showMenu: false
    });
  },
  onSettingsClick: function() {
    return this.setState({
      showSettings: true
    });
  },
  onSettingsClose: function() {
    return this.setState({
      showSettings: false
    });
  },
  onLogoutClick: function() {
    return userActions.userSignout();
  },
  renderMenu: function() {
    return LightPopover({
      baseArea: this.state.showMenu ? this.getBaseArea() : {},
      onPopoverClose: this.onPopoverClose,
      showClose: false,
      show: this.state.showMenu
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
  displayName: 'user-corner',
  mixins: [mixinSubscribe],
  propTypes: {
    _teamId: T.string.isRequired
  },
  getInitialState: function() {
    return {
      user: this.getUser(),
      showMenu: false,
      showSettings: false
    };
  },
  componentDidMount: function() {
    this._rootEl = this.refs.root;
    return this.subscribe(recorder, () => {
      return this.setState({
        user: this.getUser()
      });
    });
  },
  getUser: function() {
    return query.user(recorder.getState());
  },
  getBaseArea: function() {
    if (this._rootEl != null) {
      return this._rootEl.getBoundingClientRect();
    } else {
      return {};
    }
  },
  // event handlers
  onAvatarClick: function(event) {
    event.stopPropagation();
    return this.setState({
      showMenu: !this.state.showMenu
    });
  },
  onPopoverClose: function(event) {
    return this.setState({
      showMenu: false
    });
  },
  onSettingsClick: function() {
    return this.setState({
      showSettings: true
    });
  },
  onSettingsClose: function() {
    return this.setState({
      showSettings: false
    });
  },
  onLogoutClick: function() {
    return userActions.userSignout();
  },
  renderMenu: function() {
    return LightPopover({
      baseArea: this.state.showMenu ? this.getBaseArea() : {},
      onPopoverClose: this.onPopoverClose,
      showClose: false,
      show: this.state.showMenu
    });
  }
});
```

Response:
module.exports = React.createClass
  displayName: 'user-corner'
  mixins: [mixinSubscribe]

  propTypes:
    _teamId: T.string.isRequired

  getInitialState: ->
    user: @getUser()
    showMenu: false
    showSettings: false

  componentDidMount: ->
    @_rootEl = @refs.root
    @subscribe recorder, =>
      @setState user: @getUser()

  getUser: ->
    query.user(recorder.getState())

  getBaseArea: ->
    if @_rootEl?
      @_rootEl.getBoundingClientRect()
    else
      {}

  # event handlers

  onAvatarClick: (event) ->
    event.stopPropagation()
    @setState showMenu: (not @state.showMenu)

  onPopoverClose: (event) ->
    @setState showMenu: false

  onSettingsClick: ->
    @setState showSettings: true

  onSettingsClose: ->
    @setState showSettings: false

  onLogoutClick: ->
    userActions.userSignout()

  renderMenu: ->
    LightPopover
      baseArea: if @state.showMenu then @getBaseArea() else {}
      onPopoverClose: @onPopoverClose
      showClose: false
      show: @state.showMenu


Prompt:
module.exports = React.createClass
  displayName: 'user-corner'
  mixins: [mixinSubscribe]

  propTypes:
    _teamId: T.string.isRequired

  getInitialState: ->
    user: @getUser()
    showMenu: false
    showSettings: false

  componentDidMount: ->
    @_rootEl = @refs.root
    @subscribe recorder, =>
      @setState user: @getUser()

  getUser: ->
    query.user(recorder.getState())

  getBaseArea: ->
    if @_rootEl?
      @_rootEl.getBoundingClientRect()
    else
      {}

Response:
# event handlers

  onAvatarClick: (event) ->
    event.stopPropagation()
    @setState showMenu: (not @state.showMenu)

  onPopoverClose: (event) ->
    @setState showMenu: false

  onSettingsClick: ->
    @setState showSettings: true

  onSettingsClose: ->
    @setState showSettings: false

  onLogoutClick: ->
    userActions.userSignout()

  renderMenu: ->
    LightPopover
      baseArea: if @state.showMenu then @getBaseArea() else {}
      onPopoverClose: @onPopoverClose
      showClose: false
      show: @state.showMenu


Response:
name: 'user-corner'
      UserMenu
        onSettingsClick: @onSettingsClick
        onVersionClick: @onVersionClick
        onLogoutClick: @onLogoutClick
        onPopoverClose: @onPopoverClose

  renderSettings: ->
    LightModal
      title: lang.getText('user-preferences')
      onCloseClick: @onSettingsClose
      show: @state.showSettings
      SettingsProfile data: @state.user, onModalClose: @onSettingsClose

  render: ->

    avatarStyle =
      backgroundImage: "url('#{@state.user.get('avatarUrl')}')"

    div ref: 'root', className: 'user-corner',
      div
        className: 'img-circle avatar img-36'
        style: avatarStyle
        onClick: @onAvatarClick
      @renderMenu()
      @renderSettings()


Prompt:
name: 'user-corner'
      UserMenu
        onSettingsClick: @onSettingsClick
        onVersionClick: @onVersionClick
        onLogoutClick: @onLogoutClick
        onPopoverClose: @onPopoverClose

  renderSettings: ->
    LightModal
      title: lang.getText('user-preferences')
      onCloseClick: @onSettingsClose
      show: @state.showSettings
      SettingsProfile data: @state.user, onModalClose: @onSettingsClose

Response:
render: ->

    avatarStyle =
      backgroundImage: "url('#{@state.user.get('avatarUrl')}')"

    div ref: 'root', className: 'user-corner',
      div
        className: 'img-circle avatar img-36'
        style: avatarStyle
        onClick: @onAvatarClick
      @renderMenu()
      @renderSettings()


Response:
Store = require 'store2'
recorder = require 'actions-recorder'
Immutable = require 'immutable'

newVersion = 'jianliaoStoreV3'

purifyStore = (store) ->
  drafts = store.get('drafts')
    .update 'draft', (draft) ->
      if draft
        draft.filter (v) -> v
      else
        draft

  drafts: drafts.toJS()
  settings: store.get('settings').toJS()

window.addEventListener 'beforeunload', ->
  store = recorder.getState()
  data = purifyStore(store)

  if store.getIn(['settings', 'isLoggedIn'])
    Store.set newVersion, data
  else
    Store.remove newVersion

exports.get = ->
  data = Store.get(newVersion) or {}
  Immutable.fromJS(data)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
Store = require 'store2'
recorder = require 'actions-recorder'
Immutable = require 'immutable'

newVersion = 'jianliaoStoreV3'

purifyStore = (store) ->
  drafts = store.get('drafts')
    .update 'draft', (draft) ->
      if draft
        draft.filter (v) -> v
      else
        draft

  drafts: drafts.toJS()
  settings: store.get('settings').toJS()

window.addEventListener 'beforeunload', ->
  store = recorder.getState()
  data = purifyStore(store)

  if store.getIn(['settings', 'isLoggedIn'])
    Store.set newVersion, data
  else
    Store.remove newVersion

exports.get = ->
  data = Store.get(newVersion) or {}
  Immutable.fromJS(data)
```

Response:
var Immutable, Store, newVersion, purifyStore, recorder;

Store = require('store2');

recorder = require('actions-recorder');

Immutable = require('immutable');

newVersion = 'jianliaoStoreV3';

purifyStore = function(store) {
  var drafts;
  drafts = store.get('drafts').update('draft', function(draft) {
    if (draft) {
      return draft.filter(function(v) {
        return v;
      });
    } else {
      return draft;
    }
  });
  return {
    drafts: drafts.toJS(),
    settings: store.get('settings').toJS()
  };
};

window.addEventListener('beforeunload', function() {
  var data, store;
  store = recorder.getState();
  data = purifyStore(store);
  if (store.getIn(['settings', 'isLoggedIn'])) {
    return Store.set(newVersion, data);
  } else {
    return Store.remove(newVersion);
  }
});

exports.get = function() {
  var data;
  data = Store.get(newVersion) || {};
  return Immutable.fromJS(data);
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Immutable, Store, newVersion, purifyStore, recorder;

Store = require('store2');

recorder = require('actions-recorder');

Immutable = require('immutable');

newVersion = 'jianliaoStoreV3';

purifyStore = function(store) {
  var drafts;
  drafts = store.get('drafts').update('draft', function(draft) {
    if (draft) {
      return draft.filter(function(v) {
        return v;
      });
    } else {
      return draft;
    }
  });
  return {
    drafts: drafts.toJS(),
    settings: store.get('settings').toJS()
  };
};

window.addEventListener('beforeunload', function() {
  var data, store;
  store = recorder.getState();
  data = purifyStore(store);
  if (store.getIn(['settings', 'isLoggedIn'])) {
    return Store.set(newVersion, data);
  } else {
    return Store.remove(newVersion);
  }
});

exports.get = function() {
  var data;
  data = Store.get(newVersion) || {};
  return Immutable.fromJS(data);
};
```

Response:
Store = require 'store2'
recorder = require 'actions-recorder'
Immutable = require 'immutable'

newVersion = 'jianliaoStoreV3'

purifyStore = (store) ->
  drafts = store.get('drafts')
    .update 'draft', (draft) ->
      if draft
        draft.filter (v) -> v
      else
        draft

  drafts: drafts.toJS()
  settings: store.get('settings').toJS()

window.addEventListener 'beforeunload', ->
  store = recorder.getState()
  data = purifyStore(store)

  if store.getIn(['settings', 'isLoggedIn'])
    Store.set newVersion, data
  else
    Store.remove newVersion

exports.get = ->
  data = Store.get(newVersion) or {}
  Immutable.fromJS(data)


Prompt:
Store = require 'store2'
recorder = require 'actions-recorder'
Immutable = require 'immutable'

newVersion = 'jianliaoStoreV3'

purifyStore = (store) ->
  drafts = store.get('drafts')
    .update 'draft', (draft) ->
      if draft
        draft.filter (v) -> v
      else
        draft

Response:
drafts: drafts.toJS()
  settings: store.get('settings').toJS()

window.addEventListener 'beforeunload', ->
  store = recorder.getState()
  data = purifyStore(store)

  if store.getIn(['settings', 'isLoggedIn'])
    Store.set newVersion, data
  else
    Store.remove newVersion

exports.get = ->
  data = Store.get(newVersion) or {}
  Immutable.fromJS(data)


Response:
area: (x, y, x1, y1) ->
  (x - x1) * (x - y1)

x:  y:  10
x1: y1: 20

ok area(x, y, x1, y1) is 100

ok(area(x, y,
           x1, y1) is 100)

ok(area(
  x
  y
  x1
  y1
) is 100)

sum_of_args: ->
  sum: 0
  sum: + val for val in arguments
  sum

ok sum_of_args(1, 2, 3, 4, 5) is 15


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
area: (x, y, x1, y1) ->
  (x - x1) * (x - y1)

x:  y:  10
x1: y1: 20

ok area(x, y, x1, y1) is 100

ok(area(x, y,
           x1, y1) is 100)

ok(area(
  x
  y
  x1
  y1
) is 100)

sum_of_args: ->
  sum: 0
  sum: + val for val in arguments
  sum

ok sum_of_args(1, 2, 3, 4, 5) is 15
```

Response:
({
  area: function(x, y, x1, y1) {
    return (x - x1) * (x - y1);
  },
  x: {
    y: 10
  },
  x1: {
    y1: 20
  }
});

ok(area(x, y, x1, y1) === 100);

ok(area(x, y, x1, y1) === 100);

ok(area(x, y, x1, y1) === 100);

({
  sum_of_args: function() {
    var val;
    ({
      sum: 0,
      sum: (function() {
        var i, len, results;
        results = [];
        for (i = 0, len = arguments.length; i < len; i++) {
          val = arguments[i];
          results.push(+val);
        }
        return results;
      }).apply(this, arguments)
    });
    return sum;
  }
});

ok(sum_of_args(1, 2, 3, 4, 5) === 15);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  area: function(x, y, x1, y1) {
    return (x - x1) * (x - y1);
  },
  x: {
    y: 10
  },
  x1: {
    y1: 20
  }
});

ok(area(x, y, x1, y1) === 100);

ok(area(x, y, x1, y1) === 100);

ok(area(x, y, x1, y1) === 100);

({
  sum_of_args: function() {
    var val;
    ({
      sum: 0,
      sum: (function() {
        var i, len, results;
        results = [];
        for (i = 0, len = arguments.length; i < len; i++) {
          val = arguments[i];
          results.push(+val);
        }
        return results;
      }).apply(this, arguments)
    });
    return sum;
  }
});

ok(sum_of_args(1, 2, 3, 4, 5) === 15);
```

Response:
area: (x, y, x1, y1) ->
  (x - x1) * (x - y1)

x:  y:  10
x1: y1: 20

ok area(x, y, x1, y1) is 100

ok(area(x, y,
           x1, y1) is 100)

ok(area(
  x
  y
  x1
  y1
) is 100)

sum_of_args: ->
  sum: 0
  sum: + val for val in arguments
  sum

ok sum_of_args(1, 2, 3, 4, 5) is 15


Prompt:
area: (x, y, x1, y1) ->
  (x - x1) * (x - y1)

x:  y:  10
x1: y1: 20

ok area(x, y, x1, y1) is 100

ok(area(x, y,
           x1, y1) is 100)

ok(area(

Response:
x
  y
  x1
  y1
) is 100)

sum_of_args: ->
  sum: 0
  sum: + val for val in arguments
  sum

ok sum_of_args(1, 2, 3, 4, 5) is 15