Response:
isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)
```

Response:
({
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  isVisible: function(selector) {
    return this.find(selector).then(function(elm) {
      return elm.isDisplayed();
    });
  },
  findAll: function(selector) {
    return this.driver.findElements(Driver.By.css(this._selector(selector)));
  },
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});
```

Response:
isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

Response:
_ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->


Prompt:
args = arguments
    if (args.length > 1)
      @find(args[0]).then (el) ->
        el.clear().then ->
          el.sendKeys(args[1])
    else
     @find().then (el) ->
      el.sendKeys(args[0])

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else

Response:
return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->


Response:
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)
```

Response:
this.driver.findElements(Driver.By.css(this._selector(selector)))({
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.driver.findElements(Driver.By.css(this._selector(selector)))({
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      // WebDriver lets you go out of the child scope
      // if you pass an absolute xpath selector
      // this is a bug in WebDriver and is terrible
      // by passing a `.` this is no longer an issue.
      return el.findElement(Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});
```

Response:
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        # WebDriver lets you go out of the child scope
        # if you pass an absolute xpath selector
        # this is a bug in WebDriver and is terrible
        # by passing a `.` this is no longer an issue.
        Driver.By.xpath('.//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(

Response:
_.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)
```

Response:
this.driver.findElements(Driver.By.css(this._selector(selector)))({
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      return el.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.driver.findElements(Driver.By.css(this._selector(selector)))({
  _selector: function(selector) {
    return this.root + (selector ? ` ${selector}` : '');
  },
  findByText: function(text) {
    return this.find().then(function(el) {
      return el.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});
```

Response:
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
@driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,

Response:
"#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: (selector, value) ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: (selector, value) ->
```

Response:
this.Widget = (function() {
  class Widget {
    static extend(protoProps, staticProps) {
      var Surrogate, child, parent;
      parent = this;
      if (Object.hasOwnProperty(protoProps, 'constructor')) {
        child = protoProps.constructor;
      } else {
        child = function() {
          return parent.apply(this, arguments);
        };
      }
      child.copyProperties(this);
      child.copyProperties(staticProps);
      Surrogate = function() {
        this.constructor = child;
        return void 0;
      };
      Surrogate.prototype = this.prototype;
      child.prototype = new Surrogate();
      if (protoProps) {
        child.prototype.copyProperties(protoProps);
      }
      child.__super__ = this.prototype;
      return child;
    }

    static find(attributes) {
      var _this;
      _this = _.extend(new (this)(), attributes);
      return _this.find().then(function(el) {
        _this.el = el;
        return _this;
      });
    }

    constructor(attributes = {}) {
      _.extend(this, attributes);
      this.initialize.apply(this, arguments);
    }

    // Defines a noop initialize method intended to be
    // overridden by the user when extending a Widget base class
    initialize() {}

    click(selector) {
      return this.find(selector).click();
    }

    fill(selector, value) {}

  };

  Widget.prototype.world = World;

  // use a getter to lazily initialize driver
  Widget.getter('driver', function() {
    return this._driver || World.driver;
  });

  return Widget;

}).call(this);


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.Widget = (function() {
  class Widget {
    static extend(protoProps, staticProps) {
      var Surrogate, child, parent;
      parent = this;
      if (Object.hasOwnProperty(protoProps, 'constructor')) {
        child = protoProps.constructor;
      } else {
        child = function() {
          return parent.apply(this, arguments);
        };
      }
      child.copyProperties(this);
      child.copyProperties(staticProps);
      Surrogate = function() {
        this.constructor = child;
        return void 0;
      };
      Surrogate.prototype = this.prototype;
      child.prototype = new Surrogate();
      if (protoProps) {
        child.prototype.copyProperties(protoProps);
      }
      child.__super__ = this.prototype;
      return child;
    }

    static find(attributes) {
      var _this;
      _this = _.extend(new (this)(), attributes);
      return _this.find().then(function(el) {
        _this.el = el;
        return _this;
      });
    }

    constructor(attributes = {}) {
      _.extend(this, attributes);
      this.initialize.apply(this, arguments);
    }

    // Defines a noop initialize method intended to be
    // overridden by the user when extending a Widget base class
    initialize() {}

    click(selector) {
      return this.find(selector).click();
    }

    fill(selector, value) {}

  };

  Widget.prototype.world = World;

  // use a getter to lazily initialize driver
  Widget.getter('driver', function() {
    return this._driver || World.driver;
  });

  return Widget;

}).call(this);
```

Response:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->
    _this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: (selector, value) ->


Prompt:
class @Widget
  @extend: (protoProps, staticProps) ->
    parent = @
    if Object.hasOwnProperty(protoProps, 'constructor')
      child = protoProps.constructor
    else
      child = -> parent.apply(@, arguments)

    child.copyProperties @
    child.copyProperties staticProps

    Surrogate = ->
      @constructor = child
      return undefined

    Surrogate.prototype = @::
    child.prototype = new Surrogate()

    child::.copyProperties(protoProps) if protoProps

    child.__super__ = @::

    child

  @find = (attributes) ->

Response:
_this = _.extend(new this, attributes)

    _this.find().then (el) ->
      _this.el = el
      _this

  constructor: (attributes = {}) ->
    _.extend @, attributes

    @initialize.apply @, arguments

  # Defines a noop initialize method intended to be
  # overridden by the user when extending a Widget base class
  initialize: ->

  world: World

  # use a getter to lazily initialize driver
  @getter 'driver', ->
    @_driver || World.driver

  click: (selector) ->
    @find(selector).click()

  fill: (selector, value) ->


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

Response:
@_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getText: (selector) ->
    @find(selector).then (el) -> el.getText()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')


Response:
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)
```

Response:
({
  findByText: function(text) {
    return this.find().then(function(el) {
      return el.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  findByText: function(text) {
    return this.find().then(function(el) {
      return el.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  },
  sendKeys: function() {
    var args;
    args = arguments;
    return this.find().then((el) => {
      return el.sendKeys.apply(el, args);
    });
  }
});
```

Response:
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Prompt:
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

Response:
_map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results

  sendKeys: ->
    args = arguments
    @find().then (el) =>
      el.sendKeys.apply(el, args)


Response:
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results
```

Response:
({
  findByText: function(text) {
    return this.find().then(function(el) {
      return el.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  findByText: function(text) {
    return this.find().then(function(el) {
      return el.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'));
    });
  },
  _ensureElement: function(selector) {
    return this.driver.wait(_.bind(this.isPresent, this, selector), 10000, `${this._selector(selector)} not found`);
  },
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  }
});
```

Response:
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,

Response:
"#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    deferred = new $.Deferred

    if (@el)
      if !selector
        deferred.fulfill(@el)
      else
        return @el.findElement(Driver.By.css(selector))

      return deferred

    @_ensureElement(selector)

Response:
@driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).then (el) -> el.getOuterHtml()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(


Response:
Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"

Response:
)

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @_ensureElement(selector)
    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _ensureElement: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )


Response:
_map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
_map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results
```

Response:
({
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
({
  _map: function(collection, callback) {
    var _reduce, results;
    results = [];
    _reduce = function(p, f, i) {
      return p.then(function() {
        return callback(f, i).then(function(v) {
          return results.push(v);
        });
      });
    };
    return _.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
      return results;
    });
  }
});
```

Response:
_map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
_map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->

Response:
p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _map: (collection, callback) ->
    results = []


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

Response:
getAttribute: (attribute) ->
    @find().then (el) ->
      el.getAttribute(attribute)

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _map: (collection, callback) ->
    results = []


Response:
_reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
_reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results
```

Response:
var _reduce;

_reduce = function(p, f, i) {
  return p.then(function() {
    return callback(f, i).then(function(v) {
      return results.push(v);
    });
  });
};

_.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
  return results;
});


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

_reduce = function(p, f, i) {
  return p.then(function() {
    return callback(f, i).then(function(v) {
      return results.push(v);
    });
  });
};

_.reduce(collection, _reduce, Driver.promise.fulfilled()).then(function() {
  return results;
});
```

Response:
_reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
_reduce = (p, f, i) ->
      p.then ->

Response:
callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @find().then (el) ->
      el.findElement(
        Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]')
      )

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @driver.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'))

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    @driver.wait(
      _.bind(@isPresent, this, selector),
      10000,
      "#{@_selector(selector)} not found"
    )

    @driver.findElement(Driver.By.css(@_selector(selector)))

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @driver.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'))

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @driver.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'))

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

Response:
isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  isVisible: (selector) ->
    @find(selector).then (elm) ->
      elm.isDisplayed()

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @driver.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'))

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @driver.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'))

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

Response:
getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  findByText: (text) ->
    @driver.findElement(Driver.By.xpath('//*[normalize-space(text())=normalize-space("' + text + '")]'))

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector, transformer) ->
    transformer ||= (value) -> value
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      if value
        return transformer(value)
      else
        return selected.getText().then transformer

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

Response:
getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector) ->
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      value or selected.getText()

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector) ->
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      value or selected.getText()

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->

Response:
@find(selector).getOuterHtml()

  isPresent: (selector) ->
    @driver.isElementPresent(Driver.By.css(@_selector(selector)))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector) ->
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      value or selected.getText()

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->
     @find(selector).getOuterHtml()

  isPresent: ->
    @driver.isElementPresent(Driver.By.css(@root))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Prompt:
el = @find(selector)
    el.clear().then ->
      el.sendKeys(value)

  read: (selector) ->
    selected = @find(selector)
    selected.getAttribute('value').then (value) ->
      value or selected.getText()

  find: (selector) ->
    _selector  = Driver.By.css(@_selector(selector))
    _isPresent = =>
      @driver.isElementPresent(_selector)

    @driver.wait(_isPresent, 10000, "#{_selector} not found")
    @driver.findElement(_selector)

  getHtml: (selector) ->

Response:
@find(selector).getOuterHtml()

  isPresent: ->
    @driver.isElementPresent(Driver.By.css(@root))

  findAll: (selector) ->
    @driver.findElements(Driver.By.css(@_selector(selector)))

  _selector: (selector) ->
    @root + (if selector then " #{selector}" else '')

  _map: (collection, callback) ->
    results = []
    _reduce = (p, f, i) ->
      p.then ->
        callback(f, i).then (v) -> results.push(v)
    _.reduce(collection, _reduce, Driver.promise.fulfilled())
      .then -> results


Response:
LayerInfo = require '../layer_info.coffee'
PathRecord = require '../path_record.coffee'

module.exports = class VectorMask extends LayerInfo
  @shouldParse: (key) -> key in ['vmsk', 'vsms']

  constructor: (layer, length) ->
    super(layer, length)

    @invert = null
    @notLink = null
    @disable = null
    @paths = []

  parse: ->
    @file.seek 4, true # version
    tag = @file.readInt()

    @invert = (tag & 0x01) > 0
    @notLink = (tag & (0x01 << 1)) > 0
    @disable = (tag & (0x01 << 2)) > 0

    # I haven't figured out yet why this is 10 and not 8.
    numRecords = (@length - 10) / 26
    for i in [0...numRecords]
      record = new PathRecord(@file)
      record.parse()

      @paths.push record

  export: ->
    invert: @invert
    notLink: @notLink
    disable: @disable
    paths: @paths.map (p) -> p.export()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
LayerInfo = require '../layer_info.coffee'
PathRecord = require '../path_record.coffee'

module.exports = class VectorMask extends LayerInfo
  @shouldParse: (key) -> key in ['vmsk', 'vsms']

  constructor: (layer, length) ->
    super(layer, length)

    @invert = null
    @notLink = null
    @disable = null
    @paths = []

  parse: ->
    @file.seek 4, true # version
    tag = @file.readInt()

    @invert = (tag & 0x01) > 0
    @notLink = (tag & (0x01 << 1)) > 0
    @disable = (tag & (0x01 << 2)) > 0

    # I haven't figured out yet why this is 10 and not 8.
    numRecords = (@length - 10) / 26
    for i in [0...numRecords]
      record = new PathRecord(@file)
      record.parse()

      @paths.push record

  export: ->
    invert: @invert
    notLink: @notLink
    disable: @disable
    paths: @paths.map (p) -> p.export()
```

Response:
var LayerInfo, PathRecord, VectorMask;

LayerInfo = require('../layer_info.coffee');

PathRecord = require('../path_record.coffee');

module.exports = VectorMask = class VectorMask extends LayerInfo {
  static shouldParse(key) {
    return key === 'vmsk' || key === 'vsms';
  }

  constructor(layer, length) {
    super(layer, length);
    this.invert = null;
    this.notLink = null;
    this.disable = null;
    this.paths = [];
  }

  parse() {
    var i, j, numRecords, record, ref, results, tag;
    this.file.seek(4, true); // version
    tag = this.file.readInt();
    this.invert = (tag & 0x01) > 0;
    this.notLink = (tag & (0x01 << 1)) > 0;
    this.disable = (tag & (0x01 << 2)) > 0;
    // I haven't figured out yet why this is 10 and not 8.
    numRecords = (this.length - 10) / 26;
    results = [];
    for (i = j = 0, ref = numRecords; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {
      record = new PathRecord(this.file);
      record.parse();
      results.push(this.paths.push(record));
    }
    return results;
  }

  export() {
    return {
      invert: this.invert,
      notLink: this.notLink,
      disable: this.disable,
      paths: this.paths.map(function(p) {
        return p.export();
      })
    };
  }

};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var LayerInfo, PathRecord, VectorMask;

LayerInfo = require('../layer_info.coffee');

PathRecord = require('../path_record.coffee');

module.exports = VectorMask = class VectorMask extends LayerInfo {
  static shouldParse(key) {
    return key === 'vmsk' || key === 'vsms';
  }

  constructor(layer, length) {
    super(layer, length);
    this.invert = null;
    this.notLink = null;
    this.disable = null;
    this.paths = [];
  }

  parse() {
    var i, j, numRecords, record, ref, results, tag;
    this.file.seek(4, true); // version
    tag = this.file.readInt();
    this.invert = (tag & 0x01) > 0;
    this.notLink = (tag & (0x01 << 1)) > 0;
    this.disable = (tag & (0x01 << 2)) > 0;
    // I haven't figured out yet why this is 10 and not 8.
    numRecords = (this.length - 10) / 26;
    results = [];
    for (i = j = 0, ref = numRecords; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) {
      record = new PathRecord(this.file);
      record.parse();
      results.push(this.paths.push(record));
    }
    return results;
  }

  export() {
    return {
      invert: this.invert,
      notLink: this.notLink,
      disable: this.disable,
      paths: this.paths.map(function(p) {
        return p.export();
      })
    };
  }

};
```

Response:
LayerInfo = require '../layer_info.coffee'
PathRecord = require '../path_record.coffee'

module.exports = class VectorMask extends LayerInfo
  @shouldParse: (key) -> key in ['vmsk', 'vsms']

  constructor: (layer, length) ->
    super(layer, length)

    @invert = null
    @notLink = null
    @disable = null
    @paths = []

  parse: ->
    @file.seek 4, true # version
    tag = @file.readInt()

    @invert = (tag & 0x01) > 0
    @notLink = (tag & (0x01 << 1)) > 0
    @disable = (tag & (0x01 << 2)) > 0

    # I haven't figured out yet why this is 10 and not 8.
    numRecords = (@length - 10) / 26
    for i in [0...numRecords]
      record = new PathRecord(@file)
      record.parse()

      @paths.push record

  export: ->
    invert: @invert
    notLink: @notLink
    disable: @disable
    paths: @paths.map (p) -> p.export()


Prompt:
LayerInfo = require '../layer_info.coffee'
PathRecord = require '../path_record.coffee'

module.exports = class VectorMask extends LayerInfo
  @shouldParse: (key) -> key in ['vmsk', 'vsms']

  constructor: (layer, length) ->
    super(layer, length)

    @invert = null
    @notLink = null
    @disable = null
    @paths = []

  parse: ->
    @file.seek 4, true # version
    tag = @file.readInt()

Response:
@invert = (tag & 0x01) > 0
    @notLink = (tag & (0x01 << 1)) > 0
    @disable = (tag & (0x01 << 2)) > 0

    # I haven't figured out yet why this is 10 and not 8.
    numRecords = (@length - 10) / 26
    for i in [0...numRecords]
      record = new PathRecord(@file)
      record.parse()

      @paths.push record

  export: ->
    invert: @invert
    notLink: @notLink
    disable: @disable
    paths: @paths.map (p) -> p.export()


Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    getItemClass: (el)->
      el.getAttribute('class').then (className) =>
        if className is 'super-hero' then @world.Widgets.ListItem else @itemClass

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    getItemClass: (el)->
      el.getAttribute('class').then (className) =>
        if className is 'super-hero' then @world.Widgets.ListItem else @itemClass

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null
```

Response:
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    getItemClass: function(el) {
      return el.getAttribute('class').then((className) => {
        if (className === 'super-hero') {
          return this.world.Widgets.ListItem;
        } else {
          return this.itemClass;
        }
      });
    },
    clickEach: function() {
      return this.each(function(item) {
        return item.click();
      });
    },
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    },
    findBy: function(string) {
      return this.findWhere(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    getItemClass: function(el) {
      return el.getAttribute('class').then((className) => {
        if (className === 'super-hero') {
          return this.world.Widgets.ListItem;
        } else {
          return this.itemClass;
        }
      });
    },
    clickEach: function() {
      return this.each(function(item) {
        return item.click();
      });
    },
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    },
    findBy: function(string) {
      return this.findWhere(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};
```

Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    getItemClass: (el)->
      el.getAttribute('class').then (className) =>
        if className is 'super-hero' then @world.Widgets.ListItem else @itemClass

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    getItemClass: (el)->
      el.getAttribute('class').then (className) =>
        if className is 'super-hero' then @world.Widgets.ListItem else @itemClass

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->

Response:
@map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null
```

Response:
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    clickEach: function() {
      return this.each(function(item) {
        return item.click();
      });
    },
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    },
    findBy: function(string) {
      return this.findWhere(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    clickEach: function() {
      return this.each(function(item) {
        return item.click();
      });
    },
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    },
    findBy: function(string) {
      return this.findWhere(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};
```

Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    clickEach: ->
      @each (item) -> item.click()

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

Response:
filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null
```

Response:
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    },
    findBy: function(string) {
      return this.findWhere(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    },
    findBy: function(string) {
      return this.findWhere(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};
```

Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->

Response:
@filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null

    findBy: (string) ->
      @findWhere (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null
```

Response:
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = function() {
  this.Widgets = this.Widgets || {};
  return this.Widgets.List = this.Widget.List.extend({
    root: "ul",
    childSelector: "li",
    toArray: function() {
      return this.map(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        });
      });
    },
    filterBy: function(string) {
      return this.filter(function(item) {
        return item.find().then(function(elm) {
          return elm.getText();
        }).then(function(text) {
          return text.match(string) !== null;
        });
      });
    }
  });
};
```

Response:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->
      @map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Prompt:
module.exports = ->
  @Widgets = @Widgets || {}

  @Widgets.List = @Widget.List.extend
    root: "ul"
    childSelector: "li"

    toArray: ->

Response:
@map (item) ->
        item.find().then (elm) -> elm.getText()

    filterBy: (string) ->
      @filter (item) ->
        item
          .find()
          .then (elm) -> elm.getText()
          .then (text) -> text.match(string) != null


Response:
NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'

# Represents a  CDATA node
module.exports = class XMLCData extends XMLCharacterData

  # Initializes a new instance of `XMLCData`
  #
  # `text` CDATA text
  constructor: (parent, text) ->
    super parent

    if not text?
      throw new Error "Missing CDATA text. " + @debugInfo()

    @name = "#cdata-section"
    @type = NodeType.CData
    @value = @stringify.cdata text

  # Creates and returns a deep clone of `this`
  clone: () ->
    Object.create @

  # Converts the XML fragment to string
  #
  # `options.pretty` pretty prints the result
  # `options.indent` indentation for pretty print
  # `options.offset` how many indentations to add to every line for pretty print
  # `options.newline` newline sequence for pretty print
  toString: (options) ->
    @options.writer.cdata @, @options.writer.filterOptions(options)


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'

# Represents a  CDATA node
module.exports = class XMLCData extends XMLCharacterData

  # Initializes a new instance of `XMLCData`
  #
  # `text` CDATA text
  constructor: (parent, text) ->
    super parent

    if not text?
      throw new Error "Missing CDATA text. " + @debugInfo()

    @name = "#cdata-section"
    @type = NodeType.CData
    @value = @stringify.cdata text

  # Creates and returns a deep clone of `this`
  clone: () ->
    Object.create @

  # Converts the XML fragment to string
  #
  # `options.pretty` pretty prints the result
  # `options.indent` indentation for pretty print
  # `options.offset` how many indentations to add to every line for pretty print
  # `options.newline` newline sequence for pretty print
  toString: (options) ->
    @options.writer.cdata @, @options.writer.filterOptions(options)
```

Response:
var NodeType, XMLCData, XMLCharacterData;

NodeType = require('./NodeType');

XMLCharacterData = require('./XMLCharacterData');

// Represents a  CDATA node
module.exports = XMLCData = class XMLCData extends XMLCharacterData {
  // Initializes a new instance of `XMLCData`

  // `text` CDATA text
  constructor(parent, text) {
    super(parent);
    if (text == null) {
      throw new Error("Missing CDATA text. " + this.debugInfo());
    }
    this.name = "#cdata-section";
    this.type = NodeType.CData;
    this.value = this.stringify.cdata(text);
  }

  // Creates and returns a deep clone of `this`
  clone() {
    return Object.create(this);
  }

  // Converts the XML fragment to string

  // `options.pretty` pretty prints the result
  // `options.indent` indentation for pretty print
  // `options.offset` how many indentations to add to every line for pretty print
  // `options.newline` newline sequence for pretty print
  toString(options) {
    return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
  }

};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var NodeType, XMLCData, XMLCharacterData;

NodeType = require('./NodeType');

XMLCharacterData = require('./XMLCharacterData');

// Represents a  CDATA node
module.exports = XMLCData = class XMLCData extends XMLCharacterData {
  // Initializes a new instance of `XMLCData`

  // `text` CDATA text
  constructor(parent, text) {
    super(parent);
    if (text == null) {
      throw new Error("Missing CDATA text. " + this.debugInfo());
    }
    this.name = "#cdata-section";
    this.type = NodeType.CData;
    this.value = this.stringify.cdata(text);
  }

  // Creates and returns a deep clone of `this`
  clone() {
    return Object.create(this);
  }

  // Converts the XML fragment to string

  // `options.pretty` pretty prints the result
  // `options.indent` indentation for pretty print
  // `options.offset` how many indentations to add to every line for pretty print
  // `options.newline` newline sequence for pretty print
  toString(options) {
    return this.options.writer.cdata(this, this.options.writer.filterOptions(options));
  }

};
```

Response:
NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'

# Represents a  CDATA node
module.exports = class XMLCData extends XMLCharacterData

  # Initializes a new instance of `XMLCData`
  #
  # `text` CDATA text
  constructor: (parent, text) ->
    super parent

    if not text?
      throw new Error "Missing CDATA text. " + @debugInfo()

    @name = "#cdata-section"
    @type = NodeType.CData
    @value = @stringify.cdata text

  # Creates and returns a deep clone of `this`
  clone: () ->
    Object.create @

  # Converts the XML fragment to string
  #
  # `options.pretty` pretty prints the result
  # `options.indent` indentation for pretty print
  # `options.offset` how many indentations to add to every line for pretty print
  # `options.newline` newline sequence for pretty print
  toString: (options) ->
    @options.writer.cdata @, @options.writer.filterOptions(options)


Prompt:
NodeType = require './NodeType'
XMLCharacterData = require './XMLCharacterData'

# Represents a  CDATA node
module.exports = class XMLCData extends XMLCharacterData

  # Initializes a new instance of `XMLCData`
  #
  # `text` CDATA text
  constructor: (parent, text) ->
    super parent

    if not text?
      throw new Error "Missing CDATA text. " + @debugInfo()

    @name = "#cdata-section"

Response:
@type = NodeType.CData
    @value = @stringify.cdata text

  # Creates and returns a deep clone of `this`
  clone: () ->
    Object.create @

  # Converts the XML fragment to string
  #
  # `options.pretty` pretty prints the result
  # `options.indent` indentation for pretty print
  # `options.offset` how many indentations to add to every line for pretty print
  # `options.newline` newline sequence for pretty print
  toString: (options) ->
    @options.writer.cdata @, @options.writer.filterOptions(options)


Response:
XMLNode = require './XMLNode'
NodeType = require './NodeType'

# Represents a  CDATA node
module.exports = class XMLCData extends XMLNode

  # Initializes a new instance of `XMLCData`
  #
  # `text` CDATA text
  constructor: (parent, text) ->
    super parent

    if not text?
      throw new Error "Missing CDATA text. " + @debugInfo()

    @name = "#cdata-section"
    @type = NodeType.CData
    @value = @stringify.cdata text

  # Creates and returns a deep clone of `this`
  clone: () ->
    Object.create @

  # Converts the XML fragment to string
  #
  # `options.pretty` pretty prints the result
  # `options.indent` indentation for pretty print
  # `options.offset` how many indentations to add to every line for pretty print
  # `options.newline` newline sequence for pretty print
  toString: (options) ->
    @options.writer.cdata @, @options.writer.filterOptions(options)