Prompt:
{ replace } = require('../helpers')
TransformerBase = require('./base')

###
# Converts `function () {} ()` into `do ->`.
###

module.exports = class extends TransformerBase

  CallExpression: (node) ->
    valid =
      isIife(node) and
      isAllIdentifiers(node.arguments) and
      sameArgs(node.callee.params, node.arguments)

    return node unless valid

    replace node,
      type: 'CoffeeDoExpression'
      function: node.callee
      arguments: node.arguments

###

Response:
# Helper: ensure all nodes in `args` are Identifiers
###

isAllIdentifiers = (args) ->
  for arg in args
    return false if arg.type isnt 'Identifier'
  true

###
# Helper: ensure a CallExpression is an IIFE
###

isIife = (node) ->
  node.callee?.type is 'FunctionExpression' and
  node.callee?.id is null

###
# Helper: ensure argument names are the same
###

sameArgs = (left, right) ->
  left.map((p) -> p.name).join("/") is
    right.map((p) -> p.name).join("/")


Response:
{ replace } = require('../helpers')
TransformerBase = require('./base')

###
# Converts `function () {} ()` into `do ->`.
###

module.exports = class extends TransformerBase

  CallExpression: (node) ->
    isIife =
      node.callee?.type is 'FunctionExpression' and
      node.callee?.id is null

    return node unless isIife

    sameArgs =
      node.callee.params.map((p) -> p.name).join("/") is
      node.arguments.map((p) -> p.name).join("/")

    return node unless sameArgs

    replace node,
      type: 'CoffeeDoExpression'
      function: node.callee
      arguments: node.arguments


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
{ replace } = require('../helpers')
TransformerBase = require('./base')

###
# Converts `function () {} ()` into `do ->`.
###

module.exports = class extends TransformerBase

  CallExpression: (node) ->
    isIife =
      node.callee?.type is 'FunctionExpression' and
      node.callee?.id is null

    return node unless isIife

    sameArgs =
      node.callee.params.map((p) -> p.name).join("/") is
      node.arguments.map((p) -> p.name).join("/")

    return node unless sameArgs

    replace node,
      type: 'CoffeeDoExpression'
      function: node.callee
      arguments: node.arguments
```

Response:
var TransformerBase, replace;

({replace} = require('../helpers'));

TransformerBase = require('./base');

/*
 * Converts `function () {} ()` into `do ->`.
 */
module.exports = class extends TransformerBase {
  CallExpression(node) {
    var isIife, ref, ref1, sameArgs;
    isIife = ((ref = node.callee) != null ? ref.type : void 0) === 'FunctionExpression' && ((ref1 = node.callee) != null ? ref1.id : void 0) === null;
    if (!isIife) {
      return node;
    }
    sameArgs = node.callee.params.map(function(p) {
      return p.name;
    }).join("/") === node.arguments.map(function(p) {
      return p.name;
    }).join("/");
    if (!sameArgs) {
      return node;
    }
    return replace(node, {
      type: 'CoffeeDoExpression',
      function: node.callee,
      arguments: node.arguments
    });
  }

};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var TransformerBase, replace;

({replace} = require('../helpers'));

TransformerBase = require('./base');

/*
 * Converts `function () {} ()` into `do ->`.
 */
module.exports = class extends TransformerBase {
  CallExpression(node) {
    var isIife, ref, ref1, sameArgs;
    isIife = ((ref = node.callee) != null ? ref.type : void 0) === 'FunctionExpression' && ((ref1 = node.callee) != null ? ref1.id : void 0) === null;
    if (!isIife) {
      return node;
    }
    sameArgs = node.callee.params.map(function(p) {
      return p.name;
    }).join("/") === node.arguments.map(function(p) {
      return p.name;
    }).join("/");
    if (!sameArgs) {
      return node;
    }
    return replace(node, {
      type: 'CoffeeDoExpression',
      function: node.callee,
      arguments: node.arguments
    });
  }

};
```

Response:
{ replace } = require('../helpers')
TransformerBase = require('./base')

###
# Converts `function () {} ()` into `do ->`.
###

module.exports = class extends TransformerBase

  CallExpression: (node) ->
    isIife =
      node.callee?.type is 'FunctionExpression' and
      node.callee?.id is null

    return node unless isIife

    sameArgs =
      node.callee.params.map((p) -> p.name).join("/") is
      node.arguments.map((p) -> p.name).join("/")

    return node unless sameArgs

    replace node,
      type: 'CoffeeDoExpression'
      function: node.callee
      arguments: node.arguments


Prompt:
{ replace } = require('../helpers')
TransformerBase = require('./base')

###
# Converts `function () {} ()` into `do ->`.
###

module.exports = class extends TransformerBase

  CallExpression: (node) ->
    isIife =
      node.callee?.type is 'FunctionExpression' and
      node.callee?.id is null

Response:
return node unless isIife

    sameArgs =
      node.callee.params.map((p) -> p.name).join("/") is
      node.arguments.map((p) -> p.name).join("/")

    return node unless sameArgs

    replace node,
      type: 'CoffeeDoExpression'
      function: node.callee
      arguments: node.arguments


Response:
list = require './emojis-list'
type = require './type'

TEST_REGEX = /\:([a-z0-9_+-]+)(?:\[((?:[^\]]|\][^:])*\]?)\])?\:/g
emoticons =
  '+1': 'thumbsup'
  '-1': 'thumbsdown'

list = list.map (emoji) ->
  ":#{emoji}:"

exports.toElement = (name) ->
  name = emoticons[name] or name
  "<img align=\"absmiddle\" class=\"emoji\" src=\"https://dn-talk.oss.aliyuncs.com/icons/emoji/#{name}.png\">"

module.exports.replace = (text) ->
  return text if not type.isString(text)
  text.replace TEST_REGEX, (match, name) ->
    if list.indexOf(match) is -1
      match
    else
      exports.toElement(name)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
list = require './emojis-list'
type = require './type'

TEST_REGEX = /\:([a-z0-9_+-]+)(?:\[((?:[^\]]|\][^:])*\]?)\])?\:/g
emoticons =
  '+1': 'thumbsup'
  '-1': 'thumbsdown'

list = list.map (emoji) ->
  ":#{emoji}:"

exports.toElement = (name) ->
  name = emoticons[name] or name
  "<img align=\"absmiddle\" class=\"emoji\" src=\"https://dn-talk.oss.aliyuncs.com/icons/emoji/#{name}.png\">"

module.exports.replace = (text) ->
  return text if not type.isString(text)
  text.replace TEST_REGEX, (match, name) ->
    if list.indexOf(match) is -1
      match
    else
      exports.toElement(name)
```

Response:
var TEST_REGEX, emoticons, list, type;

list = require('./emojis-list');

type = require('./type');

TEST_REGEX = /\:([a-z0-9_+-]+)(?:\[((?:[^\]]|\][^:])*\]?)\])?\:/g;

emoticons = {
  '+1': 'thumbsup',
  '-1': 'thumbsdown'
};

list = list.map(function(emoji) {
  return `:${emoji}:`;
});

exports.toElement = function(name) {
  name = emoticons[name] || name;
  return `<img align=\"absmiddle\" class=\"emoji\" src=\"https://dn-talk.oss.aliyuncs.com/icons/emoji/${name}.png\">`;
};

module.exports.replace = function(text) {
  if (!type.isString(text)) {
    return text;
  }
  return text.replace(TEST_REGEX, function(match, name) {
    if (list.indexOf(match) === -1) {
      return match;
    } else {
      return exports.toElement(name);
    }
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var TEST_REGEX, emoticons, list, type;

list = require('./emojis-list');

type = require('./type');

TEST_REGEX = /\:([a-z0-9_+-]+)(?:\[((?:[^\]]|\][^:])*\]?)\])?\:/g;

emoticons = {
  '+1': 'thumbsup',
  '-1': 'thumbsdown'
};

list = list.map(function(emoji) {
  return `:${emoji}:`;
});

exports.toElement = function(name) {
  name = emoticons[name] || name;
  return `<img align=\"absmiddle\" class=\"emoji\" src=\"https://dn-talk.oss.aliyuncs.com/icons/emoji/${name}.png\">`;
};

module.exports.replace = function(text) {
  if (!type.isString(text)) {
    return text;
  }
  return text.replace(TEST_REGEX, function(match, name) {
    if (list.indexOf(match) === -1) {
      return match;
    } else {
      return exports.toElement(name);
    }
  });
};
```

Response:
list = require './emojis-list'
type = require './type'

TEST_REGEX = /\:([a-z0-9_+-]+)(?:\[((?:[^\]]|\][^:])*\]?)\])?\:/g
emoticons =
  '+1': 'thumbsup'
  '-1': 'thumbsdown'

list = list.map (emoji) ->
  ":#{emoji}:"

exports.toElement = (name) ->
  name = emoticons[name] or name
  "<img align=\"absmiddle\" class=\"emoji\" src=\"https://dn-talk.oss.aliyuncs.com/icons/emoji/#{name}.png\">"

module.exports.replace = (text) ->
  return text if not type.isString(text)
  text.replace TEST_REGEX, (match, name) ->
    if list.indexOf(match) is -1
      match
    else
      exports.toElement(name)


Prompt:
list = require './emojis-list'
type = require './type'

TEST_REGEX = /\:([a-z0-9_+-]+)(?:\[((?:[^\]]|\][^:])*\]?)\])?\:/g
emoticons =
  '+1': 'thumbsup'
  '-1': 'thumbsdown'

list = list.map (emoji) ->
  ":#{emoji}:"

Response:
exports.toElement = (name) ->
  name = emoticons[name] or name
  "<img align=\"absmiddle\" class=\"emoji\" src=\"https://dn-talk.oss.aliyuncs.com/icons/emoji/#{name}.png\">"

module.exports.replace = (text) ->
  return text if not type.isString(text)
  text.replace TEST_REGEX, (match, name) ->
    if list.indexOf(match) is -1
      match
    else
      exports.toElement(name)


Response:
class Run
	constructor: (@$log, @$httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		@$httpBackend.whenGET('/people').respond people

		@$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Run
	constructor: (@$log, @$httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		@$httpBackend.whenGET('/people').respond people

		@$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]
```

Response:
var Run;

Run = class Run {
  constructor($log, $httpBackend) {
    var nextId, people;
    this.$log = $log;
    this.$httpBackend = $httpBackend;
    nextId = 0;
    people = [
      {
        id: nextId++,
        name: 'Saasha',
        age: 6
      },
      {
        id: nextId++,
        name: 'Planet',
        age: 8
      }
    ];
    this.$httpBackend.whenGET('/people').respond(people);
    this.$httpBackend.whenPOST('/people').respond(function(method, url, data) {
      var isUnique, message, name, p, person;
      person = angular.fromJson(data);
      name = person.name;
      isUnique = ((function() {
        var i, len, results;
        results = [];
        for (i = 0, len = people.length; i < len; i++) {
          p = people[i];
          if (p.name === name) {
            results.push(name);
          }
        }
        return results;
      })()).length === 0;
      if (!isUnique) {
        message = {
          title: 'Duplicate!',
          message: `${name} is a duplicate.  Please enter a new name.`
        };
        return [403, message];
      }
      person.id = nextId++;
      people.push(person);
      return [200, person];
    });
  }

};

angular.module('app').run(['$log', '$httpBackend', Run]);


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

Run = class Run {
  constructor($log, $httpBackend) {
    var nextId, people;
    this.$log = $log;
    this.$httpBackend = $httpBackend;
    nextId = 0;
    people = [
      {
        id: nextId++,
        name: 'Saasha',
        age: 6
      },
      {
        id: nextId++,
        name: 'Planet',
        age: 8
      }
    ];
    this.$httpBackend.whenGET('/people').respond(people);
    this.$httpBackend.whenPOST('/people').respond(function(method, url, data) {
      var isUnique, message, name, p, person;
      person = angular.fromJson(data);
      name = person.name;
      isUnique = ((function() {
        var i, len, results;
        results = [];
        for (i = 0, len = people.length; i < len; i++) {
          p = people[i];
          if (p.name === name) {
            results.push(name);
          }
        }
        return results;
      })()).length === 0;
      if (!isUnique) {
        message = {
          title: 'Duplicate!',
          message: `${name} is a duplicate.  Please enter a new name.`
        };
        return [403, message];
      }
      person.id = nextId++;
      people.push(person);
      return [200, person];
    });
  }

};

angular.module('app').run(['$log', '$httpBackend', Run]);
```

Response:
class Run
	constructor: (@$log, @$httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		@$httpBackend.whenGET('/people').respond people

		@$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Prompt:
class Run
	constructor: (@$log, @$httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		@$httpBackend.whenGET('/people').respond people

		@$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

Response:
return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Response:
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]
```

Response:
var Run;

Run = class Run {
  constructor($log, $httpBackend) {
    var nextId, people;
    nextId = 0;
    people = [
      {
        id: nextId++,
        name: 'Saasha',
        age: 6
      },
      {
        id: nextId++,
        name: 'Planet',
        age: 8
      }
    ];
    $httpBackend.whenGET('/people').respond(people);
    $httpBackend.whenPOST('/people').respond(function(method, url, data) {
      var isUnique, message, name, p, person;
      person = angular.fromJson(data);
      name = person.name;
      isUnique = ((function() {
        var i, len, results;
        results = [];
        for (i = 0, len = people.length; i < len; i++) {
          p = people[i];
          if (p.name === name) {
            results.push(name);
          }
        }
        return results;
      })()).length === 0;
      if (!isUnique) {
        message = {
          title: 'Duplicate!',
          message: `${name} is a duplicate.  Please enter a new name.`
        };
        return [403, message];
      }
      person.id = nextId++;
      people.push(person);
      return [200, person];
    });
  }

};

angular.module('app').run(['$log', '$httpBackend', Run]);


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

Run = class Run {
  constructor($log, $httpBackend) {
    var nextId, people;
    nextId = 0;
    people = [
      {
        id: nextId++,
        name: 'Saasha',
        age: 6
      },
      {
        id: nextId++,
        name: 'Planet',
        age: 8
      }
    ];
    $httpBackend.whenGET('/people').respond(people);
    $httpBackend.whenPOST('/people').respond(function(method, url, data) {
      var isUnique, message, name, p, person;
      person = angular.fromJson(data);
      name = person.name;
      isUnique = ((function() {
        var i, len, results;
        results = [];
        for (i = 0, len = people.length; i < len; i++) {
          p = people[i];
          if (p.name === name) {
            results.push(name);
          }
        }
        return results;
      })()).length === 0;
      if (!isUnique) {
        message = {
          title: 'Duplicate!',
          message: `${name} is a duplicate.  Please enter a new name.`
        };
        return [403, message];
      }
      person.id = nextId++;
      people.push(person);
      return [200, person];
    });
  }

};

angular.module('app').run(['$log', '$httpBackend', Run]);
```

Response:
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Prompt:
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

Response:
return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Response:
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
			{id: nextId++, name: 'Cary', age: 44}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
			{id: nextId++, name: 'Cary', age: 44}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]
```

Response:
var Run;

Run = class Run {
  constructor($log, $httpBackend) {
    var nextId, people;
    nextId = 0;
    people = [
      {
        id: nextId++,
        name: 'Saasha',
        age: 6
      },
      {
        id: nextId++,
        name: 'Planet',
        age: 8
      },
      {
        id: nextId++,
        name: 'Cary',
        age: 44
      }
    ];
    $httpBackend.whenGET('/people').respond(people);
    $httpBackend.whenPOST('/people').respond(function(method, url, data) {
      var isUnique, message, name, p, person;
      person = angular.fromJson(data);
      name = person.name;
      isUnique = ((function() {
        var i, len, results;
        results = [];
        for (i = 0, len = people.length; i < len; i++) {
          p = people[i];
          if (p.name === name) {
            results.push(name);
          }
        }
        return results;
      })()).length === 0;
      if (!isUnique) {
        message = {
          title: 'Duplicate!',
          message: `${name} is a duplicate.  Please enter a new name.`
        };
        return [403, message];
      }
      person.id = nextId++;
      people.push(person);
      return [200, person];
    });
  }

};

angular.module('app').run(['$log', '$httpBackend', Run]);


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

Run = class Run {
  constructor($log, $httpBackend) {
    var nextId, people;
    nextId = 0;
    people = [
      {
        id: nextId++,
        name: 'Saasha',
        age: 6
      },
      {
        id: nextId++,
        name: 'Planet',
        age: 8
      },
      {
        id: nextId++,
        name: 'Cary',
        age: 44
      }
    ];
    $httpBackend.whenGET('/people').respond(people);
    $httpBackend.whenPOST('/people').respond(function(method, url, data) {
      var isUnique, message, name, p, person;
      person = angular.fromJson(data);
      name = person.name;
      isUnique = ((function() {
        var i, len, results;
        results = [];
        for (i = 0, len = people.length; i < len; i++) {
          p = people[i];
          if (p.name === name) {
            results.push(name);
          }
        }
        return results;
      })()).length === 0;
      if (!isUnique) {
        message = {
          title: 'Duplicate!',
          message: `${name} is a duplicate.  Please enter a new name.`
        };
        return [403, message];
      }
      person.id = nextId++;
      people.push(person);
      return [200, person];
    });
  }

};

angular.module('app').run(['$log', '$httpBackend', Run]);
```

Response:
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
			{id: nextId++, name: 'Cary', age: 44}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name
			isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Prompt:
class Run
	constructor: ($log, $httpBackend) ->
		nextId = 0

		people = [
			{id: nextId++, name: 'Saasha', age: 6}
			{id: nextId++, name: 'Planet', age: 8}
			{id: nextId++, name: 'Cary', age: 44}
		]

		$httpBackend.whenGET('/people').respond people

		$httpBackend.whenPOST('/people').respond (method, url, data) ->
			person = angular.fromJson data
			name = person.name

Response:
isUnique = (name for p in people when p.name is name).length is 0

			return if not isUnique
				message =
					title: 'Duplicate!'
					message: "#{name} is a duplicate.  Please enter a new name."

				[403, message]

			person.id = nextId++

			people.push person

			[200, person]

angular.module('app').run ['$log', '$httpBackend', Run]


Response:
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        widgetGridWidth = layout.gridColumns
                    else
                        widgetGridWidth = layout.forceGridWidth
                    widgetWidth = null
                else
                    widgetGridWidth = scope.widget.gridWidth
                    widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        widgetGridHeight = layout.gridRows
                    else
                        widgetGridHeight = layout.forceGridHeight
                    widgetHeight = null
                else
                    widgetGridHeight = scope.widget.gridHeight
                    widgetHeight = scope.widget.height


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        widgetGridWidth = layout.gridColumns
                    else
                        widgetGridWidth = layout.forceGridWidth
                    widgetWidth = null
                else
                    widgetGridWidth = scope.widget.gridWidth
                    widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        widgetGridHeight = layout.gridRows
                    else
                        widgetGridHeight = layout.forceGridHeight
                    widgetHeight = null
                else
                    widgetGridHeight = scope.widget.gridHeight
                    widgetHeight = scope.widget.height
```

Response:
({
  link: function(scope, element, attrs) {
    var $element, updateLayout;
    $element = $(element);
    // Save the SCE handler in the scope
    scope.$sce = $sce;
    scope.widgetLayout = {};
    // Update the layout
    return updateLayout = function(layout) {
      var widgetGridHeight, widgetGridWidth, widgetHeight, widgetWidth;
      // Ensure a valid layout is provided
      if (_.isUndefined(layout)) {
        return scope.postLayout();
      }
      if (isWidgetHidden()) {
        // Hide Widget to avoid occupying space
        $element.css('display', 'none');
        return scope.postLayout();
      }
      // Copy gridWidth/width into the scope
      // Apply overrides if necessary (mobile devices)
      if (layout.forceGridWidth != null) {
        if (scope.widget.gridWidth === layout.originalGridColumns) {
          widgetGridWidth = layout.gridColumns;
        } else {
          widgetGridWidth = layout.forceGridWidth;
        }
        widgetWidth = null;
      } else {
        widgetGridWidth = scope.widget.gridWidth;
        widgetWidth = scope.widget.width;
      }
      if (layout.forceGridHeight != null) {
        if (scope.widget.gridHeight === layout.originalGridRows) {
          widgetGridHeight = layout.gridRows;
        } else {
          widgetGridHeight = layout.forceGridHeight;
        }
        return widgetHeight = null;
      } else {
        widgetGridHeight = scope.widget.gridHeight;
        return widgetHeight = scope.widget.height;
      }
    };
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  link: function(scope, element, attrs) {
    var $element, updateLayout;
    $element = $(element);
    // Save the SCE handler in the scope
    scope.$sce = $sce;
    scope.widgetLayout = {};
    // Update the layout
    return updateLayout = function(layout) {
      var widgetGridHeight, widgetGridWidth, widgetHeight, widgetWidth;
      // Ensure a valid layout is provided
      if (_.isUndefined(layout)) {
        return scope.postLayout();
      }
      if (isWidgetHidden()) {
        // Hide Widget to avoid occupying space
        $element.css('display', 'none');
        return scope.postLayout();
      }
      // Copy gridWidth/width into the scope
      // Apply overrides if necessary (mobile devices)
      if (layout.forceGridWidth != null) {
        if (scope.widget.gridWidth === layout.originalGridColumns) {
          widgetGridWidth = layout.gridColumns;
        } else {
          widgetGridWidth = layout.forceGridWidth;
        }
        widgetWidth = null;
      } else {
        widgetGridWidth = scope.widget.gridWidth;
        widgetWidth = scope.widget.width;
      }
      if (layout.forceGridHeight != null) {
        if (scope.widget.gridHeight === layout.originalGridRows) {
          widgetGridHeight = layout.gridRows;
        } else {
          widgetGridHeight = layout.forceGridHeight;
        }
        return widgetHeight = null;
      } else {
        widgetGridHeight = scope.widget.gridHeight;
        return widgetHeight = scope.widget.height;
      }
    };
  }
});
```

Response:
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        widgetGridWidth = layout.gridColumns
                    else
                        widgetGridWidth = layout.forceGridWidth
                    widgetWidth = null
                else
                    widgetGridWidth = scope.widget.gridWidth
                    widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        widgetGridHeight = layout.gridRows
                    else
                        widgetGridHeight = layout.forceGridHeight
                    widgetHeight = null
                else
                    widgetGridHeight = scope.widget.gridHeight
                    widgetHeight = scope.widget.height


Prompt:
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

Response:
# Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        widgetGridWidth = layout.gridColumns
                    else
                        widgetGridWidth = layout.forceGridWidth
                    widgetWidth = null
                else
                    widgetGridWidth = scope.widget.gridWidth
                    widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        widgetGridHeight = layout.gridRows
                    else
                        widgetGridHeight = layout.forceGridHeight
                    widgetHeight = null
                else
                    widgetGridHeight = scope.widget.gridHeight
                    widgetHeight = scope.widget.height


Response:
# Calculate widget dimensions
                if widgetHeight?
                    widgetHeight = scope.widget.height
                else if widgetGridHeight?
                    widgetHeight = layout.gridSquareHeight * widgetGridHeight + ((layout.gutter) * (widgetGridHeight - 1))

                if widgetWidth?
                    widgetWidth = scope.widget.width
                else if widgetGridWidth?
                    widgetWidth = layout.gridSquareWidth * widgetGridWidth + (layout.gutter * (widgetGridWidth - 1))
                else
                    widgetWidth = layout.gridSquareWidth

                # Set height/width
                widgetWidth = Math.floor(widgetWidth) if _.isNumber(widgetWidth)
                widgetHeight = Math.floor(widgetHeight) if _.isNumber(widgetHeight)
                $element.width widgetWidth
                $element.height widgetHeight
                $element.css 'display', 'block'

                if widgetWidth < widgetHeight
                    $element.addClass 'widget-skinny'
                else
                    $element.removeClass 'widget-skinny'

                # Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]


Prompt:
# Calculate widget dimensions
                if widgetHeight?
                    widgetHeight = scope.widget.height
                else if widgetGridHeight?
                    widgetHeight = layout.gridSquareHeight * widgetGridHeight + ((layout.gutter) * (widgetGridHeight - 1))

                if widgetWidth?
                    widgetWidth = scope.widget.width
                else if widgetGridWidth?
                    widgetWidth = layout.gridSquareWidth * widgetGridWidth + (layout.gutter * (widgetGridWidth - 1))
                else
                    widgetWidth = layout.gridSquareWidth

                # Set height/width
                widgetWidth = Math.floor(widgetWidth) if _.isNumber(widgetWidth)
                widgetHeight = Math.floor(widgetHeight) if _.isNumber(widgetHeight)
                $element.width widgetWidth
                $element.height widgetHeight
                $element.css 'display', 'block'

Response:
if widgetWidth < widgetHeight
                    $element.addClass 'widget-skinny'
                else
                    $element.removeClass 'widget-skinny'

                # Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]


Response:
# If WidgetOverrides.hidden is set true or false, use its value
                    if widgetOverrides?.hidden?
                        return widgetOverrides.hidden == true

                # Else, default to the widget's "hidden" property
                return scope.widget.hidden == true

            # Store Widget API for use by Dashboards
            # Use scope.$evalAsync to ensure it gets digested by Angular
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true
                    toggleVisibility: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '

'


Prompt:
# If WidgetOverrides.hidden is set true or false, use its value
                    if widgetOverrides?.hidden?
                        return widgetOverrides.hidden == true

                # Else, default to the widget's "hidden" property
                return scope.widget.hidden == true

            # Store Widget API for use by Dashboards
            # Use scope.$evalAsync to ensure it gets digested by Angular
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true

Response:
toggleVisibility: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '<div class="dashboard-widget ' + newValue.style + noscrollClass + '" ng-include="\'/widgets/' + newValue.widget + '/' + newValue.widget + '.html\'"></div>'


Response:
if widget.allowFullscreen != false
                    template = '' + template

                if widget.helpText?
                    # Store Help Text in scope for tooltip
                    scope.helpText = _.jsExec widget.helpText
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)

                return

            # Watch for page layout changes and resize the widget
            scope.$watch 'layout', updateLayout

            # Watch for widget visibility to change
            scope.$watch 'pageOverrides', (-> updateLayout(scope.layout)), true

            return
    }


Prompt:
if widget.allowFullscreen != false
                    template = '' + template

                if widget.helpText?
                    # Store Help Text in scope for tooltip
                    scope.helpText = _.jsExec widget.helpText
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()

Response:
element.append(compiledValue)

                return

            # Watch for page layout changes and resize the widget
            scope.$watch 'layout', updateLayout

            # Watch for widget visibility to change
            scope.$watch 'pageOverrides', (-> updateLayout(scope.layout)), true

            return
    }


Response:
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = scope.widget.gridWidth
                    scope.widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = scope.widget.gridHeight
                    scope.widgetHeight = scope.widget.height


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = scope.widget.gridWidth
                    scope.widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = scope.widget.gridHeight
                    scope.widgetHeight = scope.widget.height
```

Response:
({
  link: function(scope, element, attrs) {
    var $element, updateLayout;
    $element = $(element);
    // Save the SCE handler in the scope
    scope.$sce = $sce;
    scope.widgetLayout = {};
    // Update the layout
    return updateLayout = function(layout) {
      // Ensure a valid layout is provided
      if (_.isUndefined(layout)) {
        return scope.postLayout();
      }
      if (isWidgetHidden()) {
        // Hide Widget to avoid occupying space
        $element.css('display', 'none');
        return scope.postLayout();
      }
      // Copy gridWidth/width into the scope
      // Apply overrides if necessary (mobile devices)
      if (layout.forceGridWidth != null) {
        if (scope.widget.gridWidth === layout.originalGridColumns) {
          scope.widgetGridWidth = layout.gridColumns;
        } else {
          scope.widgetGridWidth = layout.forceGridWidth;
        }
        scope.widgetWidth = null;
      } else {
        scope.widgetGridWidth = scope.widget.gridWidth;
        scope.widgetWidth = scope.widget.width;
      }
      if (layout.forceGridHeight != null) {
        if (scope.widget.gridHeight === layout.originalGridRows) {
          scope.widgetGridHeight = layout.gridRows;
        } else {
          scope.widgetGridHeight = layout.forceGridHeight;
        }
        return scope.widgetHeight = null;
      } else {
        scope.widgetGridHeight = scope.widget.gridHeight;
        return scope.widgetHeight = scope.widget.height;
      }
    };
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  link: function(scope, element, attrs) {
    var $element, updateLayout;
    $element = $(element);
    // Save the SCE handler in the scope
    scope.$sce = $sce;
    scope.widgetLayout = {};
    // Update the layout
    return updateLayout = function(layout) {
      // Ensure a valid layout is provided
      if (_.isUndefined(layout)) {
        return scope.postLayout();
      }
      if (isWidgetHidden()) {
        // Hide Widget to avoid occupying space
        $element.css('display', 'none');
        return scope.postLayout();
      }
      // Copy gridWidth/width into the scope
      // Apply overrides if necessary (mobile devices)
      if (layout.forceGridWidth != null) {
        if (scope.widget.gridWidth === layout.originalGridColumns) {
          scope.widgetGridWidth = layout.gridColumns;
        } else {
          scope.widgetGridWidth = layout.forceGridWidth;
        }
        scope.widgetWidth = null;
      } else {
        scope.widgetGridWidth = scope.widget.gridWidth;
        scope.widgetWidth = scope.widget.width;
      }
      if (layout.forceGridHeight != null) {
        if (scope.widget.gridHeight === layout.originalGridRows) {
          scope.widgetGridHeight = layout.gridRows;
        } else {
          scope.widgetGridHeight = layout.forceGridHeight;
        }
        return scope.widgetHeight = null;
      } else {
        scope.widgetGridHeight = scope.widget.gridHeight;
        return scope.widgetHeight = scope.widget.height;
      }
    };
  }
});
```

Response:
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = scope.widget.gridWidth
                    scope.widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = scope.widget.gridHeight
                    scope.widgetHeight = scope.widget.height


Prompt:
link: (scope, element, attrs) ->

            $element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Update the layout
            updateLayout = (layout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

Response:
# Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if scope.widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = scope.widget.gridWidth
                    scope.widgetWidth = scope.widget.width

                if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = scope.widget.gridHeight
                    scope.widgetHeight = scope.widget.height


Response:
# Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = scope.widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = scope.widget.width
                else if scope.widgetGridWidth?
                    scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)
                scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width scope.widgetWidth
                $element.height scope.widgetHeight
                $element.css 'display', 'block'

                if scope.widgetWidth < scope.widgetHeight
                    $element.addClass 'widget-skinny'
                else
                    $element.removeClass 'widget-skinny'

                # Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]


Prompt:
# Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = scope.widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = scope.widget.width
                else if scope.widgetGridWidth?
                    scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)
                scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width scope.widgetWidth
                $element.height scope.widgetHeight
                $element.css 'display', 'block'

Response:
if scope.widgetWidth < scope.widgetHeight
                    $element.addClass 'widget-skinny'
                else
                    $element.removeClass 'widget-skinny'

                # Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]


Response:
if widget.allowFullscreen != false
                    template = '' + template

                if widget.helpText?
                    scope.helpText = _.jsExec widget.helpText
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)

                return

            # Watch for page layout changes and resize the widget
            scope.$watch 'layout', updateLayout, true

            # Watch for widget visibility to change
            scope.$watch 'pageOverrides', (-> updateLayout(scope.layout)), true

            return
    }


Prompt:
if widget.allowFullscreen != false
                    template = '' + template

                if widget.helpText?
                    scope.helpText = _.jsExec widget.helpText
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()

Response:
element.append(compiledValue)

                return

            # Watch for page layout changes and resize the widget
            scope.$watch 'layout', updateLayout, true

            # Watch for widget visibility to change
            scope.$watch 'pageOverrides', (-> updateLayout(scope.layout)), true

            return
    }


Response:
# Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = scope.widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = scope.widget.width
                else if scope.widgetGridWidth?
                    scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)
                scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width scope.widgetWidth
                $element.height scope.widgetHeight
                $element.css 'display', 'block'

                # Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]

                    # If WidgetOverrides.hidden is set true or false, use its value
                    if widgetOverrides?.hidden?
                        return widgetOverrides.hidden == true

                # Else, default to the widget's "hidden" property
                return scope.widget.hidden == true


Prompt:
# Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = scope.widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = scope.widget.width
                else if scope.widgetGridWidth?
                    scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)
                scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width scope.widgetWidth
                $element.height scope.widgetHeight
                $element.css 'display', 'block'

Response:
# Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]

                    # If WidgetOverrides.hidden is set true or false, use its value
                    if widgetOverrides?.hidden?
                        return widgetOverrides.hidden == true

                # Else, default to the widget's "hidden" property
                return scope.widget.hidden == true


Response:
# Store Widget API for use by Dashboards
            # Use scope.$evalAsync to ensure it gets digested by Angular
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true
                    toggleVisibility: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '

'

                if widget.allowFullscreen != false
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# Store Widget API for use by Dashboards
            # Use scope.$evalAsync to ensure it gets digested by Angular
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true
                    toggleVisibility: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '<div class="dashboard-widget ' + newValue.style + noscrollClass + '" ng-include="\'/widgets/' + newValue.widget + '/' + newValue.widget + '.html\'"></div>'

                if widget.allowFullscreen != false
                    template = '<i class="widget-fullscreen fa fa-arrows-alt" title="Click to view fullscreen"></i>' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)
```

Response:
// Store Widget API for use by Dashboards
// Use scope.$evalAsync to ensure it gets digested by Angular
if (scope.widget.name != null) {
  $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
    show: function() {
      return scope.$evalAsync(function() {
        var ref, ref1, widgetOverrides;
        widgetOverrides = (ref = scope.pageOverrides) != null ? (ref1 = ref.widgets) != null ? ref1[scope.widgetIndex] : void 0 : void 0;
        return widgetOverrides.hidden = false;
      });
    },
    hide: function() {
      return scope.$evalAsync(function() {
        var ref, ref1, widgetOverrides;
        widgetOverrides = (ref = scope.pageOverrides) != null ? (ref1 = ref.widgets) != null ? ref1[scope.widgetIndex] : void 0 : void 0;
        return widgetOverrides.hidden = true;
      });
    },
    toggleVisibility: function() {
      return scope.$evalAsync(function() {
        var ref, ref1, widgetOverrides;
        widgetOverrides = (ref = scope.pageOverrides) != null ? (ref1 = ref.widgets) != null ? ref1[scope.widgetIndex] : void 0 : void 0;
        return widgetOverrides.hidden = !widgetOverrides.hidden;
      });
    }
  };
}

// Watch for the widget model to change, indicating this widget needs to be updated
scope.$watch('widget', function(newValue, oldValue) {
  var compiledValue, noscrollClass, template, widget;
  widget = newValue;
  // Ignore widgets without a type
  if (_.isEmpty(widget.widget)) {
    return;
  }
  noscrollClass = widget.noscroll === true ? ' widget-noscroll' : '';
  // Create the include for the specific widget referenced
  template = '<div class="dashboard-widget ' + newValue.style + noscrollClass + '" ng-include="\'/widgets/' + newValue.widget + '/' + newValue.widget + '.html\'"></div>';
  if (widget.allowFullscreen !== false) {
    template = '<i class="widget-fullscreen fa fa-arrows-alt" title="Click to view fullscreen"></i>' + template;
  }
  compiledValue = $compile(template)(scope);
  // Replace the current contents with the newly compiled element
  element.contents().remove();
  return element.append(compiledValue);
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// Store Widget API for use by Dashboards
// Use scope.$evalAsync to ensure it gets digested by Angular
if (scope.widget.name != null) {
  $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
    show: function() {
      return scope.$evalAsync(function() {
        var ref, ref1, widgetOverrides;
        widgetOverrides = (ref = scope.pageOverrides) != null ? (ref1 = ref.widgets) != null ? ref1[scope.widgetIndex] : void 0 : void 0;
        return widgetOverrides.hidden = false;
      });
    },
    hide: function() {
      return scope.$evalAsync(function() {
        var ref, ref1, widgetOverrides;
        widgetOverrides = (ref = scope.pageOverrides) != null ? (ref1 = ref.widgets) != null ? ref1[scope.widgetIndex] : void 0 : void 0;
        return widgetOverrides.hidden = true;
      });
    },
    toggleVisibility: function() {
      return scope.$evalAsync(function() {
        var ref, ref1, widgetOverrides;
        widgetOverrides = (ref = scope.pageOverrides) != null ? (ref1 = ref.widgets) != null ? ref1[scope.widgetIndex] : void 0 : void 0;
        return widgetOverrides.hidden = !widgetOverrides.hidden;
      });
    }
  };
}

// Watch for the widget model to change, indicating this widget needs to be updated
scope.$watch('widget', function(newValue, oldValue) {
  var compiledValue, noscrollClass, template, widget;
  widget = newValue;
  // Ignore widgets without a type
  if (_.isEmpty(widget.widget)) {
    return;
  }
  noscrollClass = widget.noscroll === true ? ' widget-noscroll' : '';
  // Create the include for the specific widget referenced
  template = '<div class="dashboard-widget ' + newValue.style + noscrollClass + '" ng-include="\'/widgets/' + newValue.widget + '/' + newValue.widget + '.html\'"></div>';
  if (widget.allowFullscreen !== false) {
    template = '<i class="widget-fullscreen fa fa-arrows-alt" title="Click to view fullscreen"></i>' + template;
  }
  compiledValue = $compile(template)(scope);
  // Replace the current contents with the newly compiled element
  element.contents().remove();
  return element.append(compiledValue);
});
```

Response:
# Store Widget API for use by Dashboards
            # Use scope.$evalAsync to ensure it gets digested by Angular
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true
                    toggleVisibility: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '<div class="dashboard-widget ' + newValue.style + noscrollClass + '" ng-include="\'/widgets/' + newValue.widget + '/' + newValue.widget + '.html\'"></div>'

                if widget.allowFullscreen != false
                    template = '<i class="widget-fullscreen fa fa-arrows-alt" title="Click to view fullscreen"></i>' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)


Prompt:
# Store Widget API for use by Dashboards
            # Use scope.$evalAsync to ensure it gets digested by Angular
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true
                    toggleVisibility: ->
                        scope.$evalAsync ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->

Response:
widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '<div class="dashboard-widget ' + newValue.style + noscrollClass + '" ng-include="\'/widgets/' + newValue.widget + '/' + newValue.widget + '.html\'"></div>'

                if widget.allowFullscreen != false
                    template = '<i class="widget-fullscreen fa fa-arrows-alt" title="Click to view fullscreen"></i>' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)


Response:
return

            # Watch for page layout changes and resize the widget
            scope.$watch 'layout', updateLayout, true

            # Watch for widget visibility to change
            scope.$watch 'pageOverrides', (-> updateLayout(scope.layout)), true

            return
    }


Prompt:
return

            # Watch for page layout changes and resize the widget
            scope.$watch 'layout', updateLayout, true

Response:
# Watch for widget visibility to change
            scope.$watch 'pageOverrides', (-> updateLayout(scope.layout)), true

            return
    }


Response:
$element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]

                    # If WidgetOverrides.hidden is set true or false, use its value
                    if widgetOverrides?.hidden?
                        return widgetOverrides.hidden == true

                # Else, default to the widget's "hidden" property
                return scope.widget.hidden == true

            # Store Widget API for use by Dashboards
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$apply ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$apply ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true
                    toggleVisibility: ->
                        scope.$apply ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for widget visibility to change
            scope.$watch isWidgetHidden, (isHidden) ->
                scope.layout.hidden = isHidden


Prompt:
$element = $(element)

            # Save the SCE handler in the scope
            scope.$sce = $sce

            scope.widgetLayout = { }

            # Determine if a Widget should be visible or hidden on the dashboard
            isWidgetHidden = ->
                return false unless scope.widget?

                if scope.pageOverrides?.widgets?
                    widgetOverrides = scope.pageOverrides.widgets?[scope.widgetIndex]

                    # If WidgetOverrides.hidden is set true or false, use its value
                    if widgetOverrides?.hidden?
                        return widgetOverrides.hidden == true

                # Else, default to the widget's "hidden" property
                return scope.widget.hidden == true

Response:
# Store Widget API for use by Dashboards
            if scope.widget.name?
                $window.Cyclotron.currentPage.widgets[scope.widget.name] = {
                    show: ->
                        scope.$apply ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = false
                    hide: ->
                        scope.$apply ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = true
                    toggleVisibility: ->
                        scope.$apply ->
                            widgetOverrides = scope.pageOverrides?.widgets?[scope.widgetIndex]
                            widgetOverrides.hidden = !widgetOverrides.hidden
                }

            # Watch for widget visibility to change
            scope.$watch isWidgetHidden, (isHidden) ->
                scope.layout.hidden = isHidden


Response:
# Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '

'

                if widget.allowFullscreen != false
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)

                return

            # Watch for page layout changes and resize the widget
            scope.$watch('layout', (layout, oldLayout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = scope.widget.gridWidth
                    scope.widgetWidth = scope.widget.width


Prompt:
# Watch for the widget model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '

'

                if widget.allowFullscreen != false
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)

Response:
return

            # Watch for page layout changes and resize the widget
            scope.$watch('layout', (layout, oldLayout) ->

                # Ensure a valid layout is provided
                if _.isUndefined(layout)
                    return scope.postLayout()

                if isWidgetHidden()
                    # Hide Widget to avoid occupying space
                    $element.css 'display', 'none'
                    return scope.postLayout()

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = scope.widget.gridWidth
                    scope.widgetWidth = scope.widget.width


Response:
if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = scope.widget.gridHeight
                    scope.widgetHeight = scope.widget.height

                # Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = scope.widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = scope.widget.width
                else if scope.widgetGridWidth?
                    scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)
                scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width scope.widgetWidth
                $element.height scope.widgetHeight
                $element.css 'display', 'block'

                # Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            , true)


Prompt:
if layout.forceGridHeight?
                    if scope.widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = scope.widget.gridHeight
                    scope.widgetHeight = scope.widget.height

                # Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = scope.widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = scope.widget.width
                else if scope.widgetGridWidth?

Response:
scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)
                scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width scope.widgetWidth
                $element.height scope.widgetHeight
                $element.css 'display', 'block'

                # Set gutter padding (other sides are handled by masonry)
                $element.css 'margin-bottom', layout.gutter

                # Trigger the post-layout update
                scope.postLayout()

                return

            , true)


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 'widget', ($compile, $sce, layoutService) ->
    {
        restrict: 'A'

        link: (scope, element, attrs) ->

            $element = $(element)

            #
            # This directive dynamically replaces itself with the specified widget in the current scope
            #
            widget = null
            layout = null

            # Save the SCE handler in the scope
            scope.$sce = $sce

            # Watch for the model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore the widget if hidden is set
                return if widget.hidden == true


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 'widget', ($compile, $sce, layoutService) ->
    {
        restrict: 'A'

Response:
link: (scope, element, attrs) ->

            $element = $(element)

            #
            # This directive dynamically replaces itself with the specified widget in the current scope
            #
            widget = null
            layout = null

            # Save the SCE handler in the scope
            scope.$sce = $sce

            # Watch for the model to change, indicating this widget needs to be updated
            scope.$watch 'widget', (newValue, oldValue) ->
                widget = newValue

                # Ignore the widget if hidden is set
                return if widget.hidden == true


Response:
# Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '

'

                if widget.allowFullscreen != false
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)

                return

            scope.$watch('layout', (layout, oldLayout) ->

                # Ignore the widget if hidden is set
                return scope.postLayout() if widget.hidden == true or _.isUndefined(layout)

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = widget.gridWidth
                    scope.widgetWidth = widget.width

                if layout.forceGridHeight?
                    if widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = widget.gridHeight
                    scope.widgetHeight = widget.height


Prompt:
# Ignore widgets without a type
                return if _.isEmpty widget.widget

                noscrollClass = if widget.noscroll == true
                    ' widget-noscroll'
                else
                    ''

                # Create the include for the specific widget referenced
                template = '

'

                if widget.allowFullscreen != false
                    template = '' + template

                compiledValue = $compile(template)(scope)

                # Replace the current contents with the newly compiled element
                element.contents().remove()
                element.append(compiledValue)

                return

            scope.$watch('layout', (layout, oldLayout) ->

Response:
# Ignore the widget if hidden is set
                return scope.postLayout() if widget.hidden == true or _.isUndefined(layout)

                # Copy gridWidth/width into the scope
                # Apply overrides if necessary (mobile devices)
                if layout.forceGridWidth?
                    if widget.gridWidth == layout.originalGridColumns
                        scope.widgetGridWidth = layout.gridColumns
                    else
                        scope.widgetGridWidth = layout.forceGridWidth
                    scope.widgetWidth = null
                else
                    scope.widgetGridWidth = widget.gridWidth
                    scope.widgetWidth = widget.width

                if layout.forceGridHeight?
                    if widget.gridHeight == layout.originalGridRows
                        scope.widgetGridHeight = layout.gridRows
                    else
                        scope.widgetGridHeight = layout.forceGridHeight
                    scope.widgetHeight = null
                else
                    scope.widgetGridHeight = widget.gridHeight
                    scope.widgetHeight = widget.height


Response:
# Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = widget.width
                else if scope.widgetGridWidth?
                    scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)
                scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width(scope.widgetWidth)
                $element.height(scope.widgetHeight)

                # Set gutter padding (other sides are handled by masonry)
                $element.css('margin-bottom', layout.gutter)

                # Trigger the post-layout update
                scope.postLayout()

                return

            , true)

            return
    }


Prompt:
# Calculate widget dimensions
                if scope.widgetHeight?
                    scope.widgetHeight = widget.height
                else if scope.widgetGridHeight?
                    scope.widgetHeight = layout.gridSquareHeight * scope.widgetGridHeight + ((layout.gutter) * (scope.widgetGridHeight - 1))

                if scope.widgetWidth?
                    scope.widgetWidth = widget.width
                else if scope.widgetGridWidth?
                    scope.widgetWidth = layout.gridSquareWidth * scope.widgetGridWidth + (layout.gutter * (scope.widgetGridWidth - 1))
                else
                    scope.widgetWidth = layout.gridSquareWidth

                # Set height/width
                scope.widgetWidth = Math.floor(scope.widgetWidth) if _.isNumber(scope.widgetWidth)

Response:
scope.widgetHeight = Math.floor(scope.widgetHeight) if _.isNumber(scope.widgetHeight)
                $element.width(scope.widgetWidth)
                $element.height(scope.widgetHeight)

                # Set gutter padding (other sides are handled by masonry)
                $element.css('margin-bottom', layout.gutter)

                # Trigger the post-layout update
                scope.postLayout()

                return

            , true)

            return
    }


Response:
ActivatePowerModeView = require '../lib/activate-power-mode-view'

describe "ActivatePowerModeView", ->
  it "has one valid test", ->
    expect("life").toBe "easy"


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
ActivatePowerModeView = require '../lib/activate-power-mode-view'

describe "ActivatePowerModeView", ->
  it "has one valid test", ->
    expect("life").toBe "easy"
```

Response:
var ActivatePowerModeView;

ActivatePowerModeView = require('../lib/activate-power-mode-view');

describe("ActivatePowerModeView", function() {
  return it("has one valid test", function() {
    return expect("life").toBe("easy");
  });
});


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

ActivatePowerModeView = require('../lib/activate-power-mode-view');

describe("ActivatePowerModeView", function() {
  return it("has one valid test", function() {
    return expect("life").toBe("easy");
  });
});
```

Response:
ActivatePowerModeView = require '../lib/activate-power-mode-view'

describe "ActivatePowerModeView", ->
  it "has one valid test", ->
    expect("life").toBe "easy"


Prompt: ActivatePowerModeView = require '../lib/activate-power-mode-view'

Response:
describe "ActivatePowerModeView", ->
  it "has one valid test", ->
    expect("life").toBe "easy"


Response:
{ replace, quote } = require('../helpers')
TransformerBase = require('./base')

###
# Transforms strings, regexes, etc
###

module.exports = class extends TransformerBase

  Literal: (node) ->
    @unpackRegexpIfNeeded(node)

  ###
  # Accounts for regexps that start with an equal sign or space.
  ###

  unpackRegexpIfNeeded: (node) ->
    return unless node.value instanceof RegExp
    m = node.value.toString().match(/^\/([\s\=].*)\/([a-z]*)$/)
    if m
      node = replace node,
        type: 'CallExpression'
        callee: { type: 'Identifier', name: 'RegExp' },
        arguments: [
          type: 'Literal'
          value: m[1]
          raw: quote(m[1])
        ]

      if m[2]
        node.arguments.push
          type: 'Literal'
          value: m[2]
          raw: quote(m[2])

      node


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
{ replace, quote } = require('../helpers')
TransformerBase = require('./base')

###
# Transforms strings, regexes, etc
###

module.exports = class extends TransformerBase

  Literal: (node) ->
    @unpackRegexpIfNeeded(node)

  ###
  # Accounts for regexps that start with an equal sign or space.
  ###

  unpackRegexpIfNeeded: (node) ->
    return unless node.value instanceof RegExp
    m = node.value.toString().match(/^\/([\s\=].*)\/([a-z]*)$/)
    if m
      node = replace node,
        type: 'CallExpression'
        callee: { type: 'Identifier', name: 'RegExp' },
        arguments: [
          type: 'Literal'
          value: m[1]
          raw: quote(m[1])
        ]

      if m[2]
        node.arguments.push
          type: 'Literal'
          value: m[2]
          raw: quote(m[2])

      node
```

Response:
var TransformerBase, quote, replace;

({replace, quote} = require('../helpers'));

TransformerBase = require('./base');

/*
 * Transforms strings, regexes, etc
 */
module.exports = class extends TransformerBase {
  Literal(node) {
    return this.unpackRegexpIfNeeded(node);
  }

  /*
   * Accounts for regexps that start with an equal sign or space.
   */
  unpackRegexpIfNeeded(node) {
    var m;
    if (!(node.value instanceof RegExp)) {
      return;
    }
    m = node.value.toString().match(/^\/([\s\=].*)\/([a-z]*)$/);
    if (m) {
      node = replace(node, {
        type: 'CallExpression',
        callee: {
          type: 'Identifier',
          name: 'RegExp'
        },
        arguments: [
          {
            type: 'Literal',
            value: m[1],
            raw: quote(m[1])
          }
        ]
      });
      if (m[2]) {
        node.arguments.push({
          type: 'Literal',
          value: m[2],
          raw: quote(m[2])
        });
      }
      return node;
    }
  }

};