Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Dataflow, Editor, Model, Storage, Util, _,
  hasProp = {}.hasOwnProperty;

_ = require("underscore");

Dataflow = require("../Dataflow/Dataflow");

Model = require("./Model");

Util = require("../Util/Util");

Storage = require("../Storage/Storage");

module.exports = Editor = (function() {
  class Editor {
    constructor() {
      this._setupSerializer();
      this._setupProject();
    }

    _setupProject() {
      this.loadFromLocalStorage();
      if (!this.project) {
        return this.project = new Model.Project();
      }
    }

    _setupSerializer() {
      var builtInObjects, name, object, ref;
      builtInObjects = [];
      ref = this._builtIn();
      for (name in ref) {
        if (!hasProp.call(ref, name)) continue;
        object = ref[name];
        if (_.isFunction(object)) {
          object = object.prototype;
        }
        Util.assignId(object, name);
        builtInObjects.push(object);
      }
      return this.serializer = new Storage.Serializer(builtInObjects);
    }

    // builtIn returns all of the built in classes and objects that are used as
    // the "anchors" for serialization and deserialization. That is, all of the
    // objects and classes which should not themselves be serialized but instead
    // be *referenced* from a serialization. When deserialized, these references
    // are then bound appropriately.
    _builtIn() {
      var builtIn;
      builtIn = _.clone(Model);
      builtIn["SpreadEnv"] = Dataflow.SpreadEnv;
      builtIn["Matrix"] = Util.Matrix;
      return builtIn;
    }

    load(jsonString) {
      var json;
      json = JSON.parse(jsonString);
      if (json.type === "Apparatus" && json.version === this.version) {
        return this.project = this.serializer.dejsonify(json);
      }
    }

    save() {
      var json, jsonString;
      json = this.serializer.jsonify(this.project);
      json.type = "Apparatus";
      json.version = this.version;
      return jsonString = JSON.stringify(json);
    }

  };

  // TODO: get version via build process / ENV variable?
  Editor.prototype.version = "0.4.0";

  return Editor;

}).call(this);
```

Response:
_ = require "underscore"
Dataflow = require "../Dataflow/Dataflow"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @_setupSerializer()
    @_setupProject()

  _setupProject: ->
    @loadFromLocalStorage()
    if !@project
      @project = new Model.Project()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of @_builtIn()
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  # builtIn returns all of the built in classes and objects that are used as
  # the "anchors" for serialization and deserialization. That is, all of the
  # objects and classes which should not themselves be serialized but instead
  # be *referenced* from a serialization. When deserialized, these references
  # are then bound appropriately.
  _builtIn: ->
    builtIn = _.clone(Model)
    builtIn["SpreadEnv"] = Dataflow.SpreadEnv
    builtIn["Matrix"] = Util.Matrix
    return builtIn

  # TODO: get version via build process / ENV variable?
  version: "0.4.0"

  load: (jsonString) ->
    json = JSON.parse(jsonString)
    if json.type == "Apparatus" and json.version == @version
      @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    json.version = @version
    jsonString = JSON.stringify(json)


Prompt:
_ = require "underscore"
Dataflow = require "../Dataflow/Dataflow"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @_setupSerializer()
    @_setupProject()

  _setupProject: ->
    @loadFromLocalStorage()
    if !@project
      @project = new Model.Project()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of @_builtIn()
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

Response:
# builtIn returns all of the built in classes and objects that are used as
  # the "anchors" for serialization and deserialization. That is, all of the
  # objects and classes which should not themselves be serialized but instead
  # be *referenced* from a serialization. When deserialized, these references
  # are then bound appropriately.
  _builtIn: ->
    builtIn = _.clone(Model)
    builtIn["SpreadEnv"] = Dataflow.SpreadEnv
    builtIn["Matrix"] = Util.Matrix
    return builtIn

  # TODO: get version via build process / ENV variable?
  version: "0.4.0"

  load: (jsonString) ->
    json = JSON.parse(jsonString)
    if json.type == "Apparatus" and json.version == @version
      @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    json.version = @version
    jsonString = JSON.stringify(json)


Response:
return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString

  loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]
    if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

  # ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString

  loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]
    if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

  # ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo
```

Response:
return jsonString({
  // ===========================================================================
  // Local Storage
  // ===========================================================================
  localStorageName: "apparatus",
  saveToLocalStorage: function() {
    var jsonString;
    jsonString = this.save();
    return window.localStorage[this.localStorageName] = jsonString;
  },
  loadFromLocalStorage: function() {
    var jsonString;
    jsonString = window.localStorage[this.localStorageName];
    if (jsonString) {
      return this.load(jsonString);
    }
  },
  resetLocalStorage: function() {
    return delete window.localStorage[this.localStorageName];
  },
  // ===========================================================================
  // Revision History
  // ===========================================================================
  checkpoint: function() {
    return this.saveToLocalStorage();
  }
});

// TODO: undo, redo


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
return jsonString({
  // ===========================================================================
  // Local Storage
  // ===========================================================================
  localStorageName: "apparatus",
  saveToLocalStorage: function() {
    var jsonString;
    jsonString = this.save();
    return window.localStorage[this.localStorageName] = jsonString;
  },
  loadFromLocalStorage: function() {
    var jsonString;
    jsonString = window.localStorage[this.localStorageName];
    if (jsonString) {
      return this.load(jsonString);
    }
  },
  resetLocalStorage: function() {
    return delete window.localStorage[this.localStorageName];
  },
  // ===========================================================================
  // Revision History
  // ===========================================================================
  checkpoint: function() {
    return this.saveToLocalStorage();
  }
});

// TODO: undo, redo
```

Response:
return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString

  loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]
    if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

  # ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo


Prompt:
return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString

  loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]

Response:
if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

  # ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo


Response:
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @_setupSerializer()
    @_setupProject()

  _setupProject: ->
    @loadFromLocalStorage()
    if !@project
      @project = new Model.Project()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  # TODO: get version via build process / ENV variable?
  version: "0.4.0"

  load: (jsonString) ->
    json = JSON.parse(jsonString)
    if json.type == "Apparatus" and json.version == @version
      @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    json.version = @version
    jsonString = JSON.stringify(json)
    return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @_setupSerializer()
    @_setupProject()

  _setupProject: ->
    @loadFromLocalStorage()
    if !@project
      @project = new Model.Project()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  # TODO: get version via build process / ENV variable?
  version: "0.4.0"

  load: (jsonString) ->
    json = JSON.parse(jsonString)
    if json.type == "Apparatus" and json.version == @version
      @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    json.version = @version
    jsonString = JSON.stringify(json)
    return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString
```

Response:
var Editor, Model, Storage, Util, _,
  hasProp = {}.hasOwnProperty;

_ = require("underscore");

Model = require("./Model");

Util = require("../Util/Util");

Storage = require("../Storage/Storage");

module.exports = Editor = (function() {
  class Editor {
    constructor() {
      this._setupSerializer();
      this._setupProject();
    }

    _setupProject() {
      this.loadFromLocalStorage();
      if (!this.project) {
        return this.project = new Model.Project();
      }
    }

    _setupSerializer() {
      var builtInObjects, name, object;
      builtInObjects = [];
      for (name in Model) {
        if (!hasProp.call(Model, name)) continue;
        object = Model[name];
        if (_.isFunction(object)) {
          object = object.prototype;
        }
        Util.assignId(object, name);
        builtInObjects.push(object);
      }
      return this.serializer = new Storage.Serializer(builtInObjects);
    }

    load(jsonString) {
      var json;
      json = JSON.parse(jsonString);
      if (json.type === "Apparatus" && json.version === this.version) {
        return this.project = this.serializer.dejsonify(json);
      }
    }

    save() {
      var json, jsonString;
      json = this.serializer.jsonify(this.project);
      json.type = "Apparatus";
      json.version = this.version;
      jsonString = JSON.stringify(json);
      return jsonString;
    }

    saveToLocalStorage() {
      var jsonString;
      jsonString = this.save();
      return window.localStorage[this.localStorageName] = jsonString;
    }

  };

  // TODO: get version via build process / ENV variable?
  Editor.prototype.version = "0.4.0";

  // ===========================================================================
  // Local Storage
  // ===========================================================================
  Editor.prototype.localStorageName = "apparatus";

  return Editor;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Editor, Model, Storage, Util, _,
  hasProp = {}.hasOwnProperty;

_ = require("underscore");

Model = require("./Model");

Util = require("../Util/Util");

Storage = require("../Storage/Storage");

module.exports = Editor = (function() {
  class Editor {
    constructor() {
      this._setupSerializer();
      this._setupProject();
    }

    _setupProject() {
      this.loadFromLocalStorage();
      if (!this.project) {
        return this.project = new Model.Project();
      }
    }

    _setupSerializer() {
      var builtInObjects, name, object;
      builtInObjects = [];
      for (name in Model) {
        if (!hasProp.call(Model, name)) continue;
        object = Model[name];
        if (_.isFunction(object)) {
          object = object.prototype;
        }
        Util.assignId(object, name);
        builtInObjects.push(object);
      }
      return this.serializer = new Storage.Serializer(builtInObjects);
    }

    load(jsonString) {
      var json;
      json = JSON.parse(jsonString);
      if (json.type === "Apparatus" && json.version === this.version) {
        return this.project = this.serializer.dejsonify(json);
      }
    }

    save() {
      var json, jsonString;
      json = this.serializer.jsonify(this.project);
      json.type = "Apparatus";
      json.version = this.version;
      jsonString = JSON.stringify(json);
      return jsonString;
    }

    saveToLocalStorage() {
      var jsonString;
      jsonString = this.save();
      return window.localStorage[this.localStorageName] = jsonString;
    }

  };

  // TODO: get version via build process / ENV variable?
  Editor.prototype.version = "0.4.0";

  // ===========================================================================
  // Local Storage
  // ===========================================================================
  Editor.prototype.localStorageName = "apparatus";

  return Editor;

}).call(this);
```

Response:
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @_setupSerializer()
    @_setupProject()

  _setupProject: ->
    @loadFromLocalStorage()
    if !@project
      @project = new Model.Project()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  # TODO: get version via build process / ENV variable?
  version: "0.4.0"

  load: (jsonString) ->
    json = JSON.parse(jsonString)
    if json.type == "Apparatus" and json.version == @version
      @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    json.version = @version
    jsonString = JSON.stringify(json)
    return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString


Prompt:
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @_setupSerializer()
    @_setupProject()

  _setupProject: ->
    @loadFromLocalStorage()
    if !@project
      @project = new Model.Project()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

Response:
# TODO: get version via build process / ENV variable?
  version: "0.4.0"

  load: (jsonString) ->
    json = JSON.parse(jsonString)
    if json.type == "Apparatus" and json.version == @version
      @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    json.version = @version
    jsonString = JSON.stringify(json)
    return jsonString

  # ===========================================================================
  # Local Storage
  # ===========================================================================

  localStorageName: "apparatus"

  saveToLocalStorage: ->
    jsonString = @save()
    window.localStorage[@localStorageName] = jsonString


Response:
loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]
    if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

  # ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]
    if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

  # ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo
```

Response:
({
  loadFromLocalStorage: function() {
    var jsonString;
    jsonString = window.localStorage[this.localStorageName];
    if (jsonString) {
      return this.load(jsonString);
    }
  },
  resetLocalStorage: function() {
    return delete window.localStorage[this.localStorageName];
  },
  // ===========================================================================
  // Revision History
  // ===========================================================================
  checkpoint: function() {
    return this.saveToLocalStorage();
  }
});

// TODO: undo, redo


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  loadFromLocalStorage: function() {
    var jsonString;
    jsonString = window.localStorage[this.localStorageName];
    if (jsonString) {
      return this.load(jsonString);
    }
  },
  resetLocalStorage: function() {
    return delete window.localStorage[this.localStorageName];
  },
  // ===========================================================================
  // Revision History
  // ===========================================================================
  checkpoint: function() {
    return this.saveToLocalStorage();
  }
});

// TODO: undo, redo
```

Response:
loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]
    if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

  # ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo


Prompt:
loadFromLocalStorage: ->
    jsonString = window.localStorage[@localStorageName]
    if jsonString
      @load(jsonString)

  resetLocalStorage: ->
    delete window.localStorage[@localStorageName]

Response:
# ===========================================================================
  # Revision History
  # ===========================================================================

  checkpoint: ->
    @saveToLocalStorage()

  # TODO: undo, redo


Response:
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @project = new Model.Project()
    @_setupSerializer()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  load: (jsonString) ->
    # TODO: check type and version to ensure it's a valid jsonString.
    json = JSON.parse(jsonString)
    @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    # TODO: get version via build process / ENV variable?
    json.version = "0.4.0"
    jsonString = JSON.stringify(json)
    return jsonString


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @project = new Model.Project()
    @_setupSerializer()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  load: (jsonString) ->
    # TODO: check type and version to ensure it's a valid jsonString.
    json = JSON.parse(jsonString)
    @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    # TODO: get version via build process / ENV variable?
    json.version = "0.4.0"
    jsonString = JSON.stringify(json)
    return jsonString
```

Response:
var Editor, Model, Storage, Util, _,
  hasProp = {}.hasOwnProperty;

_ = require("underscore");

Model = require("./Model");

Util = require("../Util/Util");

Storage = require("../Storage/Storage");

module.exports = Editor = class Editor {
  constructor() {
    this.project = new Model.Project();
    this._setupSerializer();
  }

  _setupSerializer() {
    var builtInObjects, name, object;
    builtInObjects = [];
    for (name in Model) {
      if (!hasProp.call(Model, name)) continue;
      object = Model[name];
      if (_.isFunction(object)) {
        object = object.prototype;
      }
      Util.assignId(object, name);
      builtInObjects.push(object);
    }
    return this.serializer = new Storage.Serializer(builtInObjects);
  }

  load(jsonString) {
    var json;
    // TODO: check type and version to ensure it's a valid jsonString.
    json = JSON.parse(jsonString);
    return this.project = this.serializer.dejsonify(json);
  }

  save() {
    var json, jsonString;
    json = this.serializer.jsonify(this.project);
    json.type = "Apparatus";
    // TODO: get version via build process / ENV variable?
    json.version = "0.4.0";
    jsonString = JSON.stringify(json);
    return jsonString;
  }

};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Editor, Model, Storage, Util, _,
  hasProp = {}.hasOwnProperty;

_ = require("underscore");

Model = require("./Model");

Util = require("../Util/Util");

Storage = require("../Storage/Storage");

module.exports = Editor = class Editor {
  constructor() {
    this.project = new Model.Project();
    this._setupSerializer();
  }

  _setupSerializer() {
    var builtInObjects, name, object;
    builtInObjects = [];
    for (name in Model) {
      if (!hasProp.call(Model, name)) continue;
      object = Model[name];
      if (_.isFunction(object)) {
        object = object.prototype;
      }
      Util.assignId(object, name);
      builtInObjects.push(object);
    }
    return this.serializer = new Storage.Serializer(builtInObjects);
  }

  load(jsonString) {
    var json;
    // TODO: check type and version to ensure it's a valid jsonString.
    json = JSON.parse(jsonString);
    return this.project = this.serializer.dejsonify(json);
  }

  save() {
    var json, jsonString;
    json = this.serializer.jsonify(this.project);
    json.type = "Apparatus";
    // TODO: get version via build process / ENV variable?
    json.version = "0.4.0";
    jsonString = JSON.stringify(json);
    return jsonString;
  }

};
```

Response:
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @project = new Model.Project()
    @_setupSerializer()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype
      Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  load: (jsonString) ->
    # TODO: check type and version to ensure it's a valid jsonString.
    json = JSON.parse(jsonString)
    @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    # TODO: get version via build process / ENV variable?
    json.version = "0.4.0"
    jsonString = JSON.stringify(json)
    return jsonString


Prompt:
_ = require "underscore"
Model = require "./Model"
Util = require "../Util/Util"
Storage = require "../Storage/Storage"

module.exports = class Editor
  constructor: ->
    @project = new Model.Project()
    @_setupSerializer()

  _setupSerializer: ->
    builtInObjects = []
    for own name, object of Model
      if _.isFunction(object)
        object = object.prototype

Response:
Util.assignId(object, name)
      builtInObjects.push(object)
    @serializer = new Storage.Serializer(builtInObjects)

  load: (jsonString) ->
    # TODO: check type and version to ensure it's a valid jsonString.
    json = JSON.parse(jsonString)
    @project = @serializer.dejsonify(json)

  save: ->
    json = @serializer.jsonify(@project)
    json.type = "Apparatus"
    # TODO: get version via build process / ENV variable?
    json.version = "0.4.0"
    jsonString = JSON.stringify(json)
    return jsonString


Response:
if typeof window is 'undefined'
  module.exports = {}
else
  module.exports = require 'reqwest'


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
if typeof window is 'undefined'
  module.exports = {}
else
  module.exports = require 'reqwest'
```

Response:
if (typeof window === 'undefined') {
  module.exports = {};
} else {
  module.exports = require('reqwest');
}


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
if (typeof window === 'undefined') {
  module.exports = {};
} else {
  module.exports = require('reqwest');
}
```

Response:
if typeof window is 'undefined'
  module.exports = {}
else
  module.exports = require 'reqwest'


Prompt:
if typeof window is 'undefined'
  module.exports = {}

Response:
else
  module.exports = require 'reqwest'


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

cyclotronDirectives.directive 'metricsGraphics', ->
    {
        restrict: 'EAC'
        scope:
            data: '='
            options: '='

        link: (scope, element) ->

            $element = $(element)
            chartWidth = $element.width()

            # Generate random element ID
            if _.isEmpty $element.prop('id')
                scope.id = 'mg-' + uuid.v4()
                $element.prop 'id', scope.id

            redraw = ->
                return unless scope.data?

                options =
                    title: null
                    height: 200
                    width: chartWidth
                    target: '#' + scope.id
                    data: scope.data
                    interpolate: 'cardinal'
                    interpolate_tension: 0.95

                # Apply passed options
                _.assign options, scope.options

                # Wrap mouseover
                if options.mouseover?


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

cyclotronDirectives.directive 'metricsGraphics', ->
    {
        restrict: 'EAC'
        scope:
            data: '='
            options: '='

        link: (scope, element) ->

Response:
$element = $(element)
            chartWidth = $element.width()

            # Generate random element ID
            if _.isEmpty $element.prop('id')
                scope.id = 'mg-' + uuid.v4()
                $element.prop 'id', scope.id

            redraw = ->
                return unless scope.data?

                options =
                    title: null
                    height: 200
                    width: chartWidth
                    target: '#' + scope.id
                    data: scope.data
                    interpolate: 'cardinal'
                    interpolate_tension: 0.95

                # Apply passed options
                _.assign options, scope.options

                # Wrap mouseover
                if options.mouseover?


Response:
getMouseoverText = options.mouseover
                    options.mouseover = (d, i) ->
                        text = getMouseoverText(d, i)
                        d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)

                MG.data_graphic options

            scope.$watch 'data', (newData) ->
                redraw()

            $element.resize _.debounce ->
                chartWidth = $element.width()
                redraw()
            , 100, { leading: false, maxWait: 300 }
    }


Prompt:
getMouseoverText = options.mouseover
                    options.mouseover = (d, i) ->
                        text = getMouseoverText(d, i)
                        d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)

                MG.data_graphic options

Response:
scope.$watch 'data', (newData) ->
                redraw()

            $element.resize _.debounce ->
                chartWidth = $element.width()
                redraw()
            , 100, { leading: false, maxWait: 300 }
    }


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

cyclotronDirectives.directive 'metricsGraphics', ->
    {
        restrict: 'EAC'
        scope:
            data: '='
            options: '='

        link: (scope, element) ->

            $element = $(element)
            chartWidth = $element.width()

            # Generate random element ID
            if _.isEmpty $element.prop('id')
                scope.id = 'mg-' + uuid.v4()
                $element.prop 'id', scope.id

            redraw = ->
                return unless scope.data?

                options =
                    title: null
                    height: 200
                    width: chartWidth
                    target: '#' + scope.id
                    data: scope.data
                    interpolate: 'cardinal'
                    interpolate_tension: 0.95

                # Apply passed options
                _.assign options, scope.options

                # Wrap mouseover
                if options.mouseover?


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

cyclotronDirectives.directive 'metricsGraphics', ->
    {
        restrict: 'EAC'
        scope:
            data: '='
            options: '='

        link: (scope, element) ->

Response:
$element = $(element)
            chartWidth = $element.width()

            # Generate random element ID
            if _.isEmpty $element.prop('id')
                scope.id = 'mg-' + uuid.v4()
                $element.prop 'id', scope.id

            redraw = ->
                return unless scope.data?

                options =
                    title: null
                    height: 200
                    width: chartWidth
                    target: '#' + scope.id
                    data: scope.data
                    interpolate: 'cardinal'
                    interpolate_tension: 0.95

                # Apply passed options
                _.assign options, scope.options

                # Wrap mouseover
                if options.mouseover?


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

cyclotronDirectives.directive 'metricsGraphics', ->
    {
        restrict: 'EAC'
        scope:
            data: '='
            options: '='

        link: (scope, element) ->

            $element = $(element)
            scope.width = $element.width()

            # Generate random element ID
            if _.isEmpty $element.prop('id')
                scope.id = 'mg-' + uuid.v4()
                $element.prop 'id', scope.id

            redraw = ->
                return unless scope.data?

                options =
                    title: null
                    height: 200
                    width: scope.width
                    target: '#' + scope.id
                    data: scope.data
                    interpolate: 'cardinal'
                    interpolate_tension: 0.95

                # Apply passed options
                _.assign options, scope.options

                # Wrap mouseover
                if options.mouseover?


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

cyclotronDirectives.directive 'metricsGraphics', ->
    {
        restrict: 'EAC'
        scope:
            data: '='
            options: '='

        link: (scope, element) ->

Response:
$element = $(element)
            scope.width = $element.width()

            # Generate random element ID
            if _.isEmpty $element.prop('id')
                scope.id = 'mg-' + uuid.v4()
                $element.prop 'id', scope.id

            redraw = ->
                return unless scope.data?

                options =
                    title: null
                    height: 200
                    width: scope.width
                    target: '#' + scope.id
                    data: scope.data
                    interpolate: 'cardinal'
                    interpolate_tension: 0.95

                # Apply passed options
                _.assign options, scope.options

                # Wrap mouseover
                if options.mouseover?


Response:
getMouseoverText = options.mouseover
                    options.mouseover = (d, i) ->
                        text = getMouseoverText(d, i)
                        d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)

                MG.data_graphic options

            scope.$watch 'data', (newData) ->
                redraw()

            $element.resize _.debounce ->
                scope.$apply ->
                    scope.width = $element.width()
                    redraw()
            , 90, { leading: false, maxWait: 200 }
    }


Prompt:
getMouseoverText = options.mouseover
                    options.mouseover = (d, i) ->
                        text = getMouseoverText(d, i)
                        d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)

                MG.data_graphic options

            scope.$watch 'data', (newData) ->

Response:
redraw()

            $element.resize _.debounce ->
                scope.$apply ->
                    scope.width = $element.width()
                    redraw()
            , 90, { leading: false, maxWait: 200 }
    }


Response:
getMouseoverText = options.mouseover
                    options.mouseover = (d, i) ->
                        text = getMouseoverText(d, i)
                        d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)

                MG.data_graphic options

            scope.$watch 'data', (newData) ->
                redraw()

            $element.resize(_.throttle(->
                scope.$apply ->
                    scope.width = $element.width()
                    redraw()
            , 65))
    }


Prompt:
getMouseoverText = options.mouseover
                    options.mouseover = (d, i) ->
                        text = getMouseoverText(d, i)
                        d3.select('#' + scope.id + ' svg .mg-active-datapoint').text(text)

                MG.data_graphic options

            scope.$watch 'data', (newData) ->

Response:
redraw()

            $element.resize(_.throttle(->
                scope.$apply ->
                    scope.width = $element.width()
                    redraw()
            , 65))
    }


Response:
exports.after = (store, messagesList) ->
  store.update 'searchMessages', (messages) ->
    messages.concat messagesList

exports.before = (store, messagesList) ->
  store.update 'searchMessages', (messages) ->
    messagesList.concat messages

exports.search = (store, messagesList) ->
  store.set 'searchMessages', messagesList


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
exports.after = (store, messagesList) ->
  store.update 'searchMessages', (messages) ->
    messages.concat messagesList

exports.before = (store, messagesList) ->
  store.update 'searchMessages', (messages) ->
    messagesList.concat messages

exports.search = (store, messagesList) ->
  store.set 'searchMessages', messagesList
```

Response:
exports.after = function(store, messagesList) {
  return store.update('searchMessages', function(messages) {
    return messages.concat(messagesList);
  });
};

exports.before = function(store, messagesList) {
  return store.update('searchMessages', function(messages) {
    return messagesList.concat(messages);
  });
};

exports.search = function(store, messagesList) {
  return store.set('searchMessages', messagesList);
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
exports.after = function(store, messagesList) {
  return store.update('searchMessages', function(messages) {
    return messages.concat(messagesList);
  });
};

exports.before = function(store, messagesList) {
  return store.update('searchMessages', function(messages) {
    return messagesList.concat(messages);
  });
};

exports.search = function(store, messagesList) {
  return store.set('searchMessages', messagesList);
};
```

Response:
exports.after = (store, messagesList) ->
  store.update 'searchMessages', (messages) ->
    messages.concat messagesList

exports.before = (store, messagesList) ->
  store.update 'searchMessages', (messages) ->
    messagesList.concat messages

exports.search = (store, messagesList) ->
  store.set 'searchMessages', messagesList


Prompt:
exports.after = (store, messagesList) ->
  store.update 'searchMessages', (messages) ->
    messages.concat messagesList

exports.before = (store, messagesList) ->

Response:
store.update 'searchMessages', (messages) ->
    messagesList.concat messages

exports.search = (store, messagesList) ->
  store.set 'searchMessages', messagesList


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        current++
        done(err) if numOfTests == current


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        current++
        done(err) if numOfTests == current
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi.output(options.url, options).then(function(response) {
        current++;
        if (numOfTests === current) {
          return done();
        }
      }).catch(function(err) {
        current++;
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi.output(options.url, options).then(function(response) {
        current++;
        if (numOfTests === current) {
          return done();
        }
      }).catch(function(err) {
        current++;
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        current++
        done(err) if numOfTests == current


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

Response:
grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        current++
        done(err) if numOfTests == current


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        done(err) if numOfTests == current


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        done(err) if numOfTests == current
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi.output(options.url, options).then(function(response) {
        current++;
        if (numOfTests === current) {
          return done();
        }
      }).catch(function(err) {
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi.output(options.url, options).then(function(response) {
        current++;
        if (numOfTests === current) {
          return done();
        }
      }).catch(function(err) {
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        done(err) if numOfTests == current


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt

Response:
psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options).then (response) ->
        current++
        done() if numOfTests == current
      .catch (err) ->
        done(err) if numOfTests == current


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi.output(options.url, options, function(err, response) {
        current++;
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi.output(options.url, options, function(err, response) {
        current++;
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt

Response:
psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi.output(options.url, options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi(options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi(options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi(options, function(err, response) {
        current++;
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var current, done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    current = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi(options, function(err, response) {
        current++;
        if (numOfTests === current) {
          return done(err);
        }
      }));
    }
    return results;
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi(options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt

Response:
psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    current    = 0

    for index, options of params
      psi(options, (err, response) ->
        current++
        done(err) if numOfTests == current
      )


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done(err) if numOfTests == index
      )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done(err) if numOfTests == index
      )
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    index = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi(options, function(err, response) {
        index++;
        if (numOfTests === index) {
          return done(err);
        }
      }));
    }
    return results;
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    index = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi(options, function(err, response) {
        index++;
        if (numOfTests === index) {
          return done(err);
        }
      }));
    }
    return results;
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done(err) if numOfTests == index
      )


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt

Response:
psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done(err) if numOfTests == index
      )


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done() if numOfTests == index
      )


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done() if numOfTests == index
      )
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    index = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi(options, function(err, response) {
        index++;
        if (numOfTests === index) {
          return done();
        }
      }));
    }
    return results;
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, psi;
  config = require('./lib/config').init(grunt);
  psi = require('psi');
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var done, index, numOfTests, options, params, results;
    done = this.async();
    params = config.params(this.options(this.data));
    numOfTests = params.length;
    index = 0;
    results = [];
    for (index in params) {
      options = params[index];
      results.push(psi(options, function(err, response) {
        index++;
        if (numOfTests === index) {
          return done();
        }
      }));
    }
    return results;
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt
  psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done() if numOfTests == index
      )


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config = require('./lib/config').init grunt

Response:
psi    = require('psi')

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->
    done       = this.async()
    params     = config.params this.options(this.data)
    numOfTests = params.length
    index      = 0

    for index, options of params
      psi(options, (err, response) ->
        index++
        done() if numOfTests == index
      )


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    done = this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()
    pagespeed.run(params, output.process, done)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    done = this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()
    pagespeed.run(params, output.process, done)
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var done, params;
    grunt.verbose.writeln('Running Pagespeed Insights');
    done = this.async();
    params = config.params(this.options(this.data));
    if (config.threshold()) {
      output.threshold(config.threshold());
    }
    return pagespeed.run(params, output.process, done);
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var done, params;
    grunt.verbose.writeln('Running Pagespeed Insights');
    done = this.async();
    params = config.params(this.options(this.data));
    if (config.threshold()) {
      output.threshold(config.threshold());
    }
    return pagespeed.run(params, output.process, done);
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    done = this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()
    pagespeed.run(params, output.process, done)


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

Response:
config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    done = this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()
    pagespeed.run(params, output.process, done)


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()

    pagespeed.run(params, output.process)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()

    pagespeed.run(params, output.process)
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var params;
    grunt.verbose.writeln('Running Pagespeed Insights');
    this.async();
    params = config.params(this.options(this.data));
    if (config.threshold()) {
      output.threshold(config.threshold());
    }
    return pagespeed.run(params, output.process);
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var params;
    grunt.verbose.writeln('Running Pagespeed Insights');
    this.async();
    params = config.params(this.options(this.data));
    if (config.threshold()) {
      output.threshold(config.threshold());
    }
    return pagespeed.run(params, output.process);
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()

    pagespeed.run(params, output.process)


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

Response:
config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    output.threshold(config.threshold()) if config.threshold()

    pagespeed.run(params, output.process)


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    pagespeed.run(params, output.process)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    pagespeed.run(params, output.process)
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var params;
    grunt.verbose.writeln('Running Pagespeed Insights');
    this.async();
    params = config.params(this.options(this.data));
    return pagespeed.run(params, output.process);
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    var params;
    grunt.verbose.writeln('Running Pagespeed Insights');
    this.async();
    params = config.params(this.options(this.data));
    return pagespeed.run(params, output.process);
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    pagespeed.run(params, output.process)


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

Response:
config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    params = config.params this.options(this.data)
    pagespeed.run(params, output.process)


Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    pagespeed.run(config.params(this.options(this.data)), output.process)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    pagespeed.run(config.params(this.options(this.data)), output.process)
```

Response:
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    grunt.verbose.writeln('Running Pagespeed Insights');
    this.async();
    return pagespeed.run(config.params(this.options(this.data)), output.process);
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// grunt-pagespeed
// http://www.jamescryer.com/grunt-pagespeed

// Copyright (c) 2013 James Cryer
// http://www.jamescryer.com
// Licensed under the MIT license.

'use strict';
module.exports = function(grunt) {
  var config, output, pagespeed;
  config = require('./lib/config').init(grunt);
  pagespeed = require('./lib/pagespeed').init(grunt);
  output = require('./lib/output').init(grunt);
  return grunt.registerMultiTask('pagespeed', 'Run Pagespeed Insights', function() {
    grunt.verbose.writeln('Running Pagespeed Insights');
    this.async();
    return pagespeed.run(config.params(this.options(this.data)), output.process);
  });
};
```

Response:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

  config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    pagespeed.run(config.params(this.options(this.data)), output.process)


Prompt:
#
# grunt-pagespeed
# http://www.jamescryer.com/grunt-pagespeed
#
# Copyright (c) 2013 James Cryer
# http://www.jamescryer.com
# Licensed under the MIT license.
#
'use strict'

module.exports = (grunt) ->

Response:
config    = require('./lib/config').init grunt
  pagespeed = require('./lib/pagespeed').init grunt
  output    = require('./lib/output').init grunt

  grunt.registerMultiTask 'pagespeed', 'Run Pagespeed Insights', ->

    grunt.verbose.writeln 'Running Pagespeed Insights'
    this.async()

    pagespeed.run(config.params(this.options(this.data)), output.process)


Response:
if window.nwDispatcher?.requireNwGui
  nwGui = window.nwDispatcher.requireNwGui()
  nwWin = nwGui.Window.get()

format  = require './format'
time    = require './time'
typeUtil = require './type'

if typeof window isnt 'undefined'
  Favico = require 'favico.js'
  favicon = new Favico
    animation: 'none'

exports.desktop = (data, cb) ->
  data.body = data.body.replace /[\n\r]+/g, ' '
  if window.MacGap?
    window.MacGap.notify
      title: data.title
      content: data.body or ''
  else if window.macgap?
    window.macgap.growl.notify
      title: data.title
      content: data.body or ''
  else if window.Notification?
    message = new window.Notification data.title, data
    message.onclick = -> cb?()
    time.delay 3000, ->
      message.close()

exports.favicon = (number) ->
  return if typeof window is 'undefined'
  number = Number(number) unless typeUtil.isNumber(number)
  number = format.escape100 number
  if number is @oldNumber
    return
  @oldNumber = number

  if window.MacGap?
    window.MacGap.Dock.addBadge number
  else if window.macgap?
    window.macgap.dock.badge = number
  else if nwWin
    nwWin.setBadgeLabel number
  else if window.badge? # private API targeting Electron
    window.badge number
  else
    favicon.badge number


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
if window.nwDispatcher?.requireNwGui
  nwGui = window.nwDispatcher.requireNwGui()
  nwWin = nwGui.Window.get()

format  = require './format'
time    = require './time'
typeUtil = require './type'

if typeof window isnt 'undefined'
  Favico = require 'favico.js'
  favicon = new Favico
    animation: 'none'

exports.desktop = (data, cb) ->
  data.body = data.body.replace /[\n\r]+/g, ' '
  if window.MacGap?
    window.MacGap.notify
      title: data.title
      content: data.body or ''
  else if window.macgap?
    window.macgap.growl.notify
      title: data.title
      content: data.body or ''
  else if window.Notification?
    message = new window.Notification data.title, data
    message.onclick = -> cb?()
    time.delay 3000, ->
      message.close()

exports.favicon = (number) ->
  return if typeof window is 'undefined'
  number = Number(number) unless typeUtil.isNumber(number)
  number = format.escape100 number
  if number is @oldNumber
    return
  @oldNumber = number

  if window.MacGap?
    window.MacGap.Dock.addBadge number
  else if window.macgap?
    window.macgap.dock.badge = number
  else if nwWin
    nwWin.setBadgeLabel number
  else if window.badge? # private API targeting Electron
    window.badge number
  else
    favicon.badge number
```

Response:
var Favico, favicon, format, nwGui, nwWin, ref, time, typeUtil;

if ((ref = window.nwDispatcher) != null ? ref.requireNwGui : void 0) {
  nwGui = window.nwDispatcher.requireNwGui();
  nwWin = nwGui.Window.get();
}

format = require('./format');

time = require('./time');

typeUtil = require('./type');

if (typeof window !== 'undefined') {
  Favico = require('favico.js');
  favicon = new Favico({
    animation: 'none'
  });
}

exports.desktop = function(data, cb) {
  var message;
  data.body = data.body.replace(/[\n\r]+/g, ' ');
  if (window.MacGap != null) {
    return window.MacGap.notify({
      title: data.title,
      content: data.body || ''
    });
  } else if (window.macgap != null) {
    return window.macgap.growl.notify({
      title: data.title,
      content: data.body || ''
    });
  } else if (window.Notification != null) {
    message = new window.Notification(data.title, data);
    message.onclick = function() {
      return typeof cb === "function" ? cb() : void 0;
    };
    return time.delay(3000, function() {
      return message.close();
    });
  }
};

exports.favicon = function(number) {
  if (typeof window === 'undefined') {
    return;
  }
  if (!typeUtil.isNumber(number)) {
    number = Number(number);
  }
  number = format.escape100(number);
  if (number === this.oldNumber) {
    return;
  }
  this.oldNumber = number;
  if (window.MacGap != null) {
    return window.MacGap.Dock.addBadge(number);
  } else if (window.macgap != null) {
    return window.macgap.dock.badge = number;
  } else if (nwWin) {
    return nwWin.setBadgeLabel(number);
  } else if (window.badge != null) {
    return window.badge(number);
  } else {
    return favicon.badge(number); // private API targeting Electron
  }
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Favico, favicon, format, nwGui, nwWin, ref, time, typeUtil;

if ((ref = window.nwDispatcher) != null ? ref.requireNwGui : void 0) {
  nwGui = window.nwDispatcher.requireNwGui();
  nwWin = nwGui.Window.get();
}

format = require('./format');

time = require('./time');

typeUtil = require('./type');

if (typeof window !== 'undefined') {
  Favico = require('favico.js');
  favicon = new Favico({
    animation: 'none'
  });
}

exports.desktop = function(data, cb) {
  var message;
  data.body = data.body.replace(/[\n\r]+/g, ' ');
  if (window.MacGap != null) {
    return window.MacGap.notify({
      title: data.title,
      content: data.body || ''
    });
  } else if (window.macgap != null) {
    return window.macgap.growl.notify({
      title: data.title,
      content: data.body || ''
    });
  } else if (window.Notification != null) {
    message = new window.Notification(data.title, data);
    message.onclick = function() {
      return typeof cb === "function" ? cb() : void 0;
    };
    return time.delay(3000, function() {
      return message.close();
    });
  }
};

exports.favicon = function(number) {
  if (typeof window === 'undefined') {
    return;
  }
  if (!typeUtil.isNumber(number)) {
    number = Number(number);
  }
  number = format.escape100(number);
  if (number === this.oldNumber) {
    return;
  }
  this.oldNumber = number;
  if (window.MacGap != null) {
    return window.MacGap.Dock.addBadge(number);
  } else if (window.macgap != null) {
    return window.macgap.dock.badge = number;
  } else if (nwWin) {
    return nwWin.setBadgeLabel(number);
  } else if (window.badge != null) {
    return window.badge(number);
  } else {
    return favicon.badge(number); // private API targeting Electron
  }
};
```

Response:
if window.nwDispatcher?.requireNwGui
  nwGui = window.nwDispatcher.requireNwGui()
  nwWin = nwGui.Window.get()

format  = require './format'
time    = require './time'
typeUtil = require './type'

if typeof window isnt 'undefined'
  Favico = require 'favico.js'
  favicon = new Favico
    animation: 'none'

exports.desktop = (data, cb) ->
  data.body = data.body.replace /[\n\r]+/g, ' '
  if window.MacGap?
    window.MacGap.notify
      title: data.title
      content: data.body or ''
  else if window.macgap?
    window.macgap.growl.notify
      title: data.title
      content: data.body or ''
  else if window.Notification?
    message = new window.Notification data.title, data
    message.onclick = -> cb?()
    time.delay 3000, ->
      message.close()

exports.favicon = (number) ->
  return if typeof window is 'undefined'
  number = Number(number) unless typeUtil.isNumber(number)
  number = format.escape100 number
  if number is @oldNumber
    return
  @oldNumber = number

  if window.MacGap?
    window.MacGap.Dock.addBadge number
  else if window.macgap?
    window.macgap.dock.badge = number
  else if nwWin
    nwWin.setBadgeLabel number
  else if window.badge? # private API targeting Electron
    window.badge number
  else
    favicon.badge number


Prompt:
if window.nwDispatcher?.requireNwGui
  nwGui = window.nwDispatcher.requireNwGui()
  nwWin = nwGui.Window.get()

format  = require './format'
time    = require './time'
typeUtil = require './type'

if typeof window isnt 'undefined'
  Favico = require 'favico.js'
  favicon = new Favico
    animation: 'none'

exports.desktop = (data, cb) ->
  data.body = data.body.replace /[\n\r]+/g, ' '
  if window.MacGap?
    window.MacGap.notify
      title: data.title
      content: data.body or ''
  else if window.macgap?
    window.macgap.growl.notify
      title: data.title
      content: data.body or ''

Response:
else if window.Notification?
    message = new window.Notification data.title, data
    message.onclick = -> cb?()
    time.delay 3000, ->
      message.close()

exports.favicon = (number) ->
  return if typeof window is 'undefined'
  number = Number(number) unless typeUtil.isNumber(number)
  number = format.escape100 number
  if number is @oldNumber
    return
  @oldNumber = number

  if window.MacGap?
    window.MacGap.Dock.addBadge number
  else if window.macgap?
    window.macgap.dock.badge = number
  else if nwWin
    nwWin.setBadgeLabel number
  else if window.badge? # private API targeting Electron
    window.badge number
  else
    favicon.badge number


Response:
###global define###

define ['controllers/controllers', 'services/people'], (controllers) ->
	'use strict'

	controllers.controller 'people', ['$scope', 'people', ($scope, service) ->
		$scope.error = ''
		$scope.name = ''
		$scope.people = service.people

		$scope.insertPerson = (name) ->
			service.post name
			, (Resource, getResponseHeaders) ->
				$scope.error = ''
				$scope.name = ''
			, (obj) ->
				($scope.error = obj.data) if obj.status is 403

		service.get()
	]


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
###global define###

define ['controllers/controllers', 'services/people'], (controllers) ->
	'use strict'

	controllers.controller 'people', ['$scope', 'people', ($scope, service) ->
		$scope.error = ''
		$scope.name = ''
		$scope.people = service.people

		$scope.insertPerson = (name) ->
			service.post name
			, (Resource, getResponseHeaders) ->
				$scope.error = ''
				$scope.name = ''
			, (obj) ->
				($scope.error = obj.data) if obj.status is 403

		service.get()
	]
```

Response:
/*global define*/
define(['controllers/controllers', 'services/people'], function(controllers) {
  'use strict';
  return controllers.controller('people', [
    '$scope',
    'people',
    function($scope,
    service) {
      $scope.error = '';
      $scope.name = '';
      $scope.people = service.people;
      $scope.insertPerson = function(name) {
        return service.post(name,
    function(Resource,
    getResponseHeaders) {
          $scope.error = '';
          return $scope.name = '';
        },
    function(obj) {
          if (obj.status === 403) {
            return $scope.error = obj.data;
          }
        });
      };
      return service.get();
    }
  ]);
});