Response:
Immutable = require 'immutable'

exports.read = (store, actionData) ->
  messagesList = actionData.get('messages')

  store.update 'taggedResults', (messages) ->
    messages.concat messagesList

exports.clear = (store, actionData) ->
  store.set 'taggedResults', Immutable.List()


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

exports.read = (store, actionData) ->
  messagesList = actionData.get('messages')

  store.update 'taggedResults', (messages) ->
    messages.concat messagesList

exports.clear = (store, actionData) ->
  store.set 'taggedResults', Immutable.List()
```

Response:
var Immutable;

Immutable = require('immutable');

exports.read = function(store, actionData) {
  var messagesList;
  messagesList = actionData.get('messages');
  return store.update('taggedResults', function(messages) {
    return messages.concat(messagesList);
  });
};

exports.clear = function(store, actionData) {
  return store.set('taggedResults', Immutable.List());
};


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

Immutable = require('immutable');

exports.read = function(store, actionData) {
  var messagesList;
  messagesList = actionData.get('messages');
  return store.update('taggedResults', function(messages) {
    return messages.concat(messagesList);
  });
};

exports.clear = function(store, actionData) {
  return store.set('taggedResults', Immutable.List());
};
```

Response:
Immutable = require 'immutable'

exports.read = (store, actionData) ->
  messagesList = actionData.get('messages')

  store.update 'taggedResults', (messages) ->
    messages.concat messagesList

exports.clear = (store, actionData) ->
  store.set 'taggedResults', Immutable.List()


Prompt:
Immutable = require 'immutable'

exports.read = (store, actionData) ->
  messagesList = actionData.get('messages')

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

exports.clear = (store, actionData) ->
  store.set 'taggedResults', Immutable.List()


Response:
###
Global Logger
###
module.exports = do ->
  # Create Event Emitter
  {Emitter} = require 'event-kit'
  emitter = new Emitter()
  # Create Transport with Writable Stream
  # See http://stackoverflow.com/a/21583831/2578205
  winston = require('winston')
  stream = require('stream')
  writable = new stream.Writable()
  writable._write = (chunk, encoding, next) ->
    msg = chunk.toString()
    # console.log(msg)
    emitter.emit('logging', msg)
    next()

  levels = {
    silly: 0,
    input: 1,
    verbose: 2,
    prompt: 3,
    debug: 4,
    info: 5,
    data: 6,
    help: 7,
    warn: 8,
    error: 9
  }

  return (label) ->
    transport = new (winston.transports.File)({
      label: label
      level: 'debug'
      timestamp: true
      # prettyPrint: true
      # colorize: true
      stream: writable
      json: false
    })
    # Initialize logger
    wlogger = new (winston.Logger)({
      # Configure transports
      transports: [
        transport
      ]
    })
    wlogger.on('logging', (transport, level, msg, meta)->
      loggerLevel = atom?.config.get(\


Prompt:
###
Global Logger
###
module.exports = do ->
  # Create Event Emitter
  {Emitter} = require 'event-kit'
  emitter = new Emitter()
  # Create Transport with Writable Stream
  # See http://stackoverflow.com/a/21583831/2578205
  winston = require('winston')
  stream = require('stream')
  writable = new stream.Writable()
  writable._write = (chunk, encoding, next) ->
    msg = chunk.toString()
    # console.log(msg)
    emitter.emit('logging', msg)
    next()

  levels = {
    silly: 0,
    input: 1,
    verbose: 2,
    prompt: 3,
    debug: 4,
    info: 5,

Response:
data: 6,
    help: 7,
    warn: 8,
    error: 9
  }

  return (label) ->
    transport = new (winston.transports.File)({
      label: label
      level: 'debug'
      timestamp: true
      # prettyPrint: true
      # colorize: true
      stream: writable
      json: false
    })
    # Initialize logger
    wlogger = new (winston.Logger)({
      # Configure transports
      transports: [
        transport
      ]
    })
    wlogger.on('logging', (transport, level, msg, meta)->
      loggerLevel = atom?.config.get(\


Response:
'atom-beautify.general.loggerLevel') ? "warn"
      # console.log('logging', loggerLevel, arguments)
      loggerLevelNum = levels[loggerLevel]
      levelNum = levels[level]
      if loggerLevelNum <= levelNum
        path = require('path')
        label = "#{path.dirname(transport.label)\
                    .split(path.sep).reverse()[0]}\
                    #{path.sep}#{path.basename(transport.label)}"
        d = new Date()
        console.log("#{d.toLocaleDateString()} #{d.toLocaleTimeString()} - #{label} [#{level}]: #{msg}", meta)
    )
    # Export logger methods
    loggerMethods = ['silly','debug','verbose','info','warn','error']
    logger = {}
    for method in loggerMethods
      logger[method] = wlogger[method]
    # Add logger listener
    logger.onLogging = (handler) ->
      # console.log('onLogging', handler)
      subscription = emitter.on('logging', handler)
      # console.log('emitter', emitter.handlersByEventName, subscription)
      return subscription
    # Return simplified logger
    return logger


Prompt:
'atom-beautify.general.loggerLevel') ? "warn"
      # console.log('logging', loggerLevel, arguments)
      loggerLevelNum = levels[loggerLevel]
      levelNum = levels[level]
      if loggerLevelNum <= levelNum
        path = require('path')
        label = "#{path.dirname(transport.label)\
                    .split(path.sep).reverse()[0]}\
                    #{path.sep}#{path.basename(transport.label)}"
        d = new Date()
        console.log("#{d.toLocaleDateString()} #{d.toLocaleTimeString()} - #{label} [#{level}]: #{msg}", meta)
    )

Response:
# Export logger methods
    loggerMethods = ['silly','debug','verbose','info','warn','error']
    logger = {}
    for method in loggerMethods
      logger[method] = wlogger[method]
    # Add logger listener
    logger.onLogging = (handler) ->
      # console.log('onLogging', handler)
      subscription = emitter.on('logging', handler)
      # console.log('emitter', emitter.handlersByEventName, subscription)
      return subscription
    # Return simplified logger
    return logger


Response:
Err = require 'err1st'
jsonMask = require 'json-mask'
_ = require 'lodash'
socket = require '../components/socket'
logger = require '../components/logger'

app = require '../server'

res = app.response

res.response = ->
  {err, result, req} = this
  if err
    err = new Err(err) unless err instanceof Err
    if err.code is 100  # Log the unknown error
      logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack
    @status(err.status or 400).json
      code: err.code
      message: err.locale(req.getLocale()).message
  else
    result = result?.toJSON?() or result
    if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']
      result = jsonMask(result, @req.query?.fields) or undefined
    if @req.query?.excludeFields and toString.call(result) is '[object Object]'
      result = _.omit(result, @req.query.excludeFields.split(','))
    @status(200).send(result)

res.broadcast = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, @req.get('socketId'), callback

res.publish = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, null, callback

res.join = (channel, callback) ->
  socket.join channel, @req.get('socketId'), callback

res.leave = (channel, callback) ->
  socket.leave channel, @req.get('socketId'), callback


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
Err = require 'err1st'
jsonMask = require 'json-mask'
_ = require 'lodash'
socket = require '../components/socket'
logger = require '../components/logger'

app = require '../server'

res = app.response

res.response = ->
  {err, result, req} = this
  if err
    err = new Err(err) unless err instanceof Err
    if err.code is 100  # Log the unknown error
      logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack
    @status(err.status or 400).json
      code: err.code
      message: err.locale(req.getLocale()).message
  else
    result = result?.toJSON?() or result
    if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']
      result = jsonMask(result, @req.query?.fields) or undefined
    if @req.query?.excludeFields and toString.call(result) is '[object Object]'
      result = _.omit(result, @req.query.excludeFields.split(','))
    @status(200).send(result)

res.broadcast = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, @req.get('socketId'), callback

res.publish = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, null, callback

res.join = (channel, callback) ->
  socket.join channel, @req.get('socketId'), callback

res.leave = (channel, callback) ->
  socket.leave channel, @req.get('socketId'), callback
```

Response:
var Err, _, app, jsonMask, logger, res, socket;

Err = require('err1st');

jsonMask = require('json-mask');

_ = require('lodash');

socket = require('../components/socket');

logger = require('../components/logger');

app = require('../server');

res = app.response;

res.response = function() {
  var err, ref, ref1, ref2, ref3, req, result;
  ({err, result, req} = this);
  if (err) {
    if (!(err instanceof Err)) {
      err = new Err(err);
    }
    if (err.code === 100) { // Log the unknown error
      logger.err(req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack);
    }
    return this.status(err.status || 400).json({
      code: err.code,
      message: err.locale(req.getLocale()).message
    });
  } else {
    result = (result != null ? typeof result.toJSON === "function" ? result.toJSON() : void 0 : void 0) || result;
    if (((ref = this.req.query) != null ? ref.fields : void 0) && ((ref1 = toString.call(result)) === '[object Object]' || ref1 === '[object Array]')) {
      result = jsonMask(result, (ref2 = this.req.query) != null ? ref2.fields : void 0) || void 0;
    }
    if (((ref3 = this.req.query) != null ? ref3.excludeFields : void 0) && toString.call(result) === '[object Object]') {
      result = _.omit(result, this.req.query.excludeFields.split(','));
    }
    return this.status(200).send(result);
  }
};

res.broadcast = function(channel, event, data, callback) {
  return socket.broadcast(channel, event, data, this.req.get('socketId'), callback);
};

res.publish = function(channel, event, data, callback) {
  return socket.broadcast(channel, event, data, null, callback);
};

res.join = function(channel, callback) {
  return socket.join(channel, this.req.get('socketId'), callback);
};

res.leave = function(channel, callback) {
  return socket.leave(channel, this.req.get('socketId'), callback);
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
var Err, _, app, jsonMask, logger, res, socket;

Err = require('err1st');

jsonMask = require('json-mask');

_ = require('lodash');

socket = require('../components/socket');

logger = require('../components/logger');

app = require('../server');

res = app.response;

res.response = function() {
  var err, ref, ref1, ref2, ref3, req, result;
  ({err, result, req} = this);
  if (err) {
    if (!(err instanceof Err)) {
      err = new Err(err);
    }
    if (err.code === 100) { // Log the unknown error
      logger.err(req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack);
    }
    return this.status(err.status || 400).json({
      code: err.code,
      message: err.locale(req.getLocale()).message
    });
  } else {
    result = (result != null ? typeof result.toJSON === "function" ? result.toJSON() : void 0 : void 0) || result;
    if (((ref = this.req.query) != null ? ref.fields : void 0) && ((ref1 = toString.call(result)) === '[object Object]' || ref1 === '[object Array]')) {
      result = jsonMask(result, (ref2 = this.req.query) != null ? ref2.fields : void 0) || void 0;
    }
    if (((ref3 = this.req.query) != null ? ref3.excludeFields : void 0) && toString.call(result) === '[object Object]') {
      result = _.omit(result, this.req.query.excludeFields.split(','));
    }
    return this.status(200).send(result);
  }
};

res.broadcast = function(channel, event, data, callback) {
  return socket.broadcast(channel, event, data, this.req.get('socketId'), callback);
};

res.publish = function(channel, event, data, callback) {
  return socket.broadcast(channel, event, data, null, callback);
};

res.join = function(channel, callback) {
  return socket.join(channel, this.req.get('socketId'), callback);
};

res.leave = function(channel, callback) {
  return socket.leave(channel, this.req.get('socketId'), callback);
};
```

Response:
Err = require 'err1st'
jsonMask = require 'json-mask'
_ = require 'lodash'
socket = require '../components/socket'
logger = require '../components/logger'

app = require '../server'

res = app.response

res.response = ->
  {err, result, req} = this
  if err
    err = new Err(err) unless err instanceof Err
    if err.code is 100  # Log the unknown error
      logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack
    @status(err.status or 400).json
      code: err.code
      message: err.locale(req.getLocale()).message
  else
    result = result?.toJSON?() or result
    if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']
      result = jsonMask(result, @req.query?.fields) or undefined
    if @req.query?.excludeFields and toString.call(result) is '[object Object]'
      result = _.omit(result, @req.query.excludeFields.split(','))
    @status(200).send(result)

res.broadcast = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, @req.get('socketId'), callback

res.publish = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, null, callback

res.join = (channel, callback) ->
  socket.join channel, @req.get('socketId'), callback

res.leave = (channel, callback) ->
  socket.leave channel, @req.get('socketId'), callback


Prompt:
Err = require 'err1st'
jsonMask = require 'json-mask'
_ = require 'lodash'
socket = require '../components/socket'
logger = require '../components/logger'

app = require '../server'

res = app.response

res.response = ->
  {err, result, req} = this
  if err
    err = new Err(err) unless err instanceof Err
    if err.code is 100  # Log the unknown error
      logger.err req.method, req.url, Object.keys(req.headers), Object.keys(req.query), Object.keys(req.body), err.stack
    @status(err.status or 400).json
      code: err.code
      message: err.locale(req.getLocale()).message

Response:
else
    result = result?.toJSON?() or result
    if @req.query?.fields and toString.call(result) in ['[object Object]', '[object Array]']
      result = jsonMask(result, @req.query?.fields) or undefined
    if @req.query?.excludeFields and toString.call(result) is '[object Object]'
      result = _.omit(result, @req.query.excludeFields.split(','))
    @status(200).send(result)

res.broadcast = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, @req.get('socketId'), callback

res.publish = (channel, event, data, callback) ->
  socket.broadcast channel, event, data, null, callback

res.join = (channel, callback) ->
  socket.join channel, @req.get('socketId'), callback

res.leave = (channel, callback) ->
  socket.leave channel, @req.get('socketId'), callback


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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

    checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url


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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

    checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url
```

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

// Provides access to the CyclotronData API
cyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {
  var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;
  defaultUrl = configService.restServiceUrl;
  checkBucketExists = function(key, url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Checking if bucket exists:', key);
    url = url + '/data/' + encodeURIComponent(key);
    req = $http.get(url);
    return req.then(function(result) {
      return true;
    }).catch(function(error) {
      return false;
    });
  };
  createBucket = function(key, data = [], url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Creating new bucket:', key);
    url = url + '/data';
    req = $http.post(url, {key, data});
    return req.then(function(result) {
      return result.data;
    });
  };
  return ensureBucketExists = function(key, url = defaultUrl) {
    return checkBucketExists(key, url).then(function(result) {
      if (!result) {
        return createBucket(key, [], url);
      }
    });
  };
});


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

// Provides access to the CyclotronData API
cyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {
  var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;
  defaultUrl = configService.restServiceUrl;
  checkBucketExists = function(key, url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Checking if bucket exists:', key);
    url = url + '/data/' + encodeURIComponent(key);
    req = $http.get(url);
    return req.then(function(result) {
      return true;
    }).catch(function(error) {
      return false;
    });
  };
  createBucket = function(key, data = [], url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Creating new bucket:', key);
    url = url + '/data';
    req = $http.post(url, {key, data});
    return req.then(function(result) {
      return result.data;
    });
  };
  return ensureBucketExists = function(key, url = defaultUrl) {
    return checkBucketExists(key, url).then(function(result) {
      if (!result) {
        return createBucket(key, [], url);
      }
    });
  };
});
```

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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

    checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url


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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

Response:
checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url


Response:
return {
        # Gets a list of available buckets (without data)
        getBuckets: (url = defaultUrl) ->
            url = url + '/data'
            req = $http.get url
            req.then (result) -> result.data

        bucketExists: checkBucketExists

        # Creates a new bucket
        createBucket: createBucket

        # Deletes a bucket
        deleteBucket: (key, url = defaultUrl) ->
            url = url + '/data/' + encodeURIComponent(key)
            req = $http.delete url

        # Gets a bucket
        getBucket: (key, url = defaultUrl) ->
            url = url + '/data/' + encodeURIComponent(key)
            req = $http.get url
            req.then (result) ->
                result.data
            .catch (error) ->
                null

        # Gets just the data for a bucket
        getBucketData: (key, url = defaultUrl) ->
            url = url + '/data/' + encodeURIComponent(key) + '/data'
            req = $http.get url
            req.then (result) ->
                result.data
            .catch (error) ->
                null

        # Replaces the data for a bucket
        updateBucketData: (key, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->
                url = url + '/data/' + encodeURIComponent(key) + '/data'
                req = $http.put url, data
                req.then (result) -> result.data


Prompt:
return {
        # Gets a list of available buckets (without data)
        getBuckets: (url = defaultUrl) ->
            url = url + '/data'
            req = $http.get url
            req.then (result) -> result.data

        bucketExists: checkBucketExists

        # Creates a new bucket
        createBucket: createBucket

        # Deletes a bucket
        deleteBucket: (key, url = defaultUrl) ->
            url = url + '/data/' + encodeURIComponent(key)
            req = $http.delete url

        # Gets a bucket
        getBucket: (key, url = defaultUrl) ->
            url = url + '/data/' + encodeURIComponent(key)

Response:
req = $http.get url
            req.then (result) ->
                result.data
            .catch (error) ->
                null

        # Gets just the data for a bucket
        getBucketData: (key, url = defaultUrl) ->
            url = url + '/data/' + encodeURIComponent(key) + '/data'
            req = $http.get url
            req.then (result) ->
                result.data
            .catch (error) ->
                null

        # Replaces the data for a bucket
        updateBucketData: (key, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->
                url = url + '/data/' + encodeURIComponent(key) + '/data'
                req = $http.put url, data
                req.then (result) -> result.data


Response:
# Appends to the data for a bucket
        append: (key, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->
                url = url + '/data/' + encodeURIComponent(key) + '/append'
                req = $http.post url, data
                req.then (result) -> result.data

        # Upserts a row of data for a bucket
        upsert: (key, matchingKeys, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->
                url = url + '/data/' + encodeURIComponent(key) + '/upsert'
                req = $http.post url, { keys: matchingKeys, data: data }
                req.then (result) -> result.data

        # Removes matching data from a bucket
        remove: (key, matchingKeys, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->
                url = url + '/data/' + encodeURIComponent(key) + '/remove'
                req = $http.post url, matchingKeys
                req.then (result) -> result.data
    }


Prompt:
# Appends to the data for a bucket
        append: (key, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->
                url = url + '/data/' + encodeURIComponent(key) + '/append'
                req = $http.post url, data
                req.then (result) -> result.data

        # Upserts a row of data for a bucket
        upsert: (key, matchingKeys, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->

Response:
url = url + '/data/' + encodeURIComponent(key) + '/upsert'
                req = $http.post url, { keys: matchingKeys, data: data }
                req.then (result) -> result.data

        # Removes matching data from a bucket
        remove: (key, matchingKeys, data, url = defaultUrl) ->
            ensureBucketExists(key, url).then ->
                url = url + '/data/' + encodeURIComponent(key) + '/remove'
                req = $http.post url, matchingKeys
                req.then (result) -> result.data
    }


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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

    checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url


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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

    checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url
```

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

// Provides access to the CyclotronData API
cyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {
  var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;
  defaultUrl = configService.restServiceUrl;
  checkBucketExists = function(key, url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Checking if bucket exists:', key);
    url = url + '/data/' + encodeURIComponent(key);
    req = $http.get(url);
    return req.then(function(result) {
      return true;
    }).catch(function(error) {
      return false;
    });
  };
  createBucket = function(key, data = [], url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Creating new bucket:', key);
    url = url + '/data';
    req = $http.post(url, {key, data});
    return req.then(function(result) {
      return result.data;
    });
  };
  return ensureBucketExists = function(key, url = defaultUrl) {
    return checkBucketExists(key, url).then(function(result) {
      if (!result) {
        return createBucket(key, [], url);
      }
    });
  };
});


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

// Provides access to the CyclotronData API
cyclotronServices.factory('cyclotronDataService', function($http, configService, logService) {
  var checkBucketExists, createBucket, defaultUrl, ensureBucketExists;
  defaultUrl = configService.restServiceUrl;
  checkBucketExists = function(key, url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Checking if bucket exists:', key);
    url = url + '/data/' + encodeURIComponent(key);
    req = $http.get(url);
    return req.then(function(result) {
      return true;
    }).catch(function(error) {
      return false;
    });
  };
  createBucket = function(key, data = [], url = defaultUrl) {
    var req;
    logService.debug('CyclotronData: Creating new bucket:', key);
    url = url + '/data';
    req = $http.post(url, {key, data});
    return req.then(function(result) {
      return result.data;
    });
  };
  return ensureBucketExists = function(key, url = defaultUrl) {
    return checkBucketExists(key, url).then(function(result) {
      if (!result) {
        return createBucket(key, [], url);
      }
    });
  };
});
```

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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

    checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url


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

#
# Provides access to the CyclotronData API
cyclotronServices.factory 'cyclotronDataService', ($http, configService, logService) ->
    defaultUrl = configService.restServiceUrl

Response:
checkBucketExists = (key, url = defaultUrl) ->
        logService.debug 'CyclotronData: Checking if bucket exists:', key
        url = url + '/data/' + encodeURIComponent(key)
        req = $http.get url
        req.then (result) ->
            true
        .catch (error) ->
            false

    createBucket = (key, data = [], url = defaultUrl) ->
        logService.debug 'CyclotronData: Creating new bucket:', key
        url = url + '/data'
        req = $http.post url, { key, data }
        req.then (result) -> result.data

    ensureBucketExists = (key, url = defaultUrl) ->
        checkBucketExists(key, url).then (result) ->
            if !result
                createBucket key, [], url


Response:
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'
    client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'
    uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    # log 'psessionid',psessionid
    # log 'client_id',client_id
    # log 'ptwebqq',ptwebqq
    # log 'uin',uin
    # log 'vfwebqq',vfwebqq

    api.send_message2user 2440652742, "你好啊" , client_id,psessionid, (ret,e)->
        log "send ret:",ret
    # log "长轮训"
    # api.long_poll client_id , psessionid , (ret)->
    #     log ret

test_long_pull()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'
    client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'
    uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    # log 'psessionid',psessionid
    # log 'client_id',client_id
    # log 'ptwebqq',ptwebqq
    # log 'uin',uin
    # log 'vfwebqq',vfwebqq

    api.send_message2user 2440652742, "你好啊" , client_id,psessionid, (ret,e)->
        log "send ret:",ret
    # log "长轮训"
    # api.long_poll client_id , psessionid , (ret)->
    #     log ret

test_long_pull()
```

Response:
//!/usr/bin/env coffee
var api, auth, config, int, log, pass, qq, test_long_pull;

int = function(v) {
  return parseInt(v);
};

log = console.log;

auth = require("../src/qqauth");

api = require("../src/qqapi");

config = require('../config');

qq = config.account;

pass = config.password;

test_long_pull = function() {
  var client_id, psessionid, ptwebqq, uin, vfwebqq;
  api.defaults_read();
  psessionid = api.defaults('psessionid');
  client_id = api.defaults('clientid');
  ptwebqq = api.defaults('ptwebqq');
  uin = api.defaults('uin');
  vfwebqq = api.defaults('vfwebqq');
  // log 'psessionid',psessionid
  // log 'client_id',client_id
  // log 'ptwebqq',ptwebqq
  // log 'uin',uin
  // log 'vfwebqq',vfwebqq
  return api.send_message2user(2440652742, "你好啊", client_id, psessionid, function(ret, e) {
    return log("send ret:", ret);
  });
};

// log "长轮训"
// api.long_poll client_id , psessionid , (ret)->
//     log ret
test_long_pull();


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
//!/usr/bin/env coffee
var api, auth, config, int, log, pass, qq, test_long_pull;

int = function(v) {
  return parseInt(v);
};

log = console.log;

auth = require("../src/qqauth");

api = require("../src/qqapi");

config = require('../config');

qq = config.account;

pass = config.password;

test_long_pull = function() {
  var client_id, psessionid, ptwebqq, uin, vfwebqq;
  api.defaults_read();
  psessionid = api.defaults('psessionid');
  client_id = api.defaults('clientid');
  ptwebqq = api.defaults('ptwebqq');
  uin = api.defaults('uin');
  vfwebqq = api.defaults('vfwebqq');
  // log 'psessionid',psessionid
  // log 'client_id',client_id
  // log 'ptwebqq',ptwebqq
  // log 'uin',uin
  // log 'vfwebqq',vfwebqq
  return api.send_message2user(2440652742, "你好啊", client_id, psessionid, function(ret, e) {
    return log("send ret:", ret);
  });
};

// log "长轮训"
// api.long_poll client_id , psessionid , (ret)->
//     log ret
test_long_pull();
```

Response:
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'
    client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'
    uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    # log 'psessionid',psessionid
    # log 'client_id',client_id
    # log 'ptwebqq',ptwebqq
    # log 'uin',uin
    # log 'vfwebqq',vfwebqq

    api.send_message2user 2440652742, "你好啊" , client_id,psessionid, (ret,e)->
        log "send ret:",ret
    # log "长轮训"
    # api.long_poll client_id , psessionid , (ret)->
    #     log ret

test_long_pull()


Prompt:
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'
    client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'

Response:
uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    # log 'psessionid',psessionid
    # log 'client_id',client_id
    # log 'ptwebqq',ptwebqq
    # log 'uin',uin
    # log 'vfwebqq',vfwebqq

    api.send_message2user 2440652742, "你好啊" , client_id,psessionid, (ret,e)->
        log "send ret:",ret
    # log "长轮训"
    # api.long_poll client_id , psessionid , (ret)->
    #     log ret

test_long_pull()


Response:
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'
    client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'
    uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    log 'psessionid',psessionid
    log 'client_id',client_id
    log 'ptwebqq',ptwebqq
    log 'uin',uin
    log 'vfwebqq',vfwebqq

    log "长轮训"
    api.long_poll client_id , psessionid , (ret)->
        log ret

test_long_pull()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'
    client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'
    uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    log 'psessionid',psessionid
    log 'client_id',client_id
    log 'ptwebqq',ptwebqq
    log 'uin',uin
    log 'vfwebqq',vfwebqq

    log "长轮训"
    api.long_poll client_id , psessionid , (ret)->
        log ret

test_long_pull()
```

Response:
//!/usr/bin/env coffee
var api, auth, config, int, log, pass, qq, test_long_pull;

int = function(v) {
  return parseInt(v);
};

log = console.log;

auth = require("../src/qqauth");

api = require("../src/qqapi");

config = require('../config');

qq = config.account;

pass = config.password;

test_long_pull = function() {
  var client_id, psessionid, ptwebqq, uin, vfwebqq;
  api.defaults_read();
  psessionid = api.defaults('psessionid');
  client_id = api.defaults('clientid');
  ptwebqq = api.defaults('ptwebqq');
  uin = api.defaults('uin');
  vfwebqq = api.defaults('vfwebqq');
  log('psessionid', psessionid);
  log('client_id', client_id);
  log('ptwebqq', ptwebqq);
  log('uin', uin);
  log('vfwebqq', vfwebqq);
  log("长轮训");
  return api.long_poll(client_id, psessionid, function(ret) {
    return log(ret);
  });
};

test_long_pull();


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
//!/usr/bin/env coffee
var api, auth, config, int, log, pass, qq, test_long_pull;

int = function(v) {
  return parseInt(v);
};

log = console.log;

auth = require("../src/qqauth");

api = require("../src/qqapi");

config = require('../config');

qq = config.account;

pass = config.password;

test_long_pull = function() {
  var client_id, psessionid, ptwebqq, uin, vfwebqq;
  api.defaults_read();
  psessionid = api.defaults('psessionid');
  client_id = api.defaults('clientid');
  ptwebqq = api.defaults('ptwebqq');
  uin = api.defaults('uin');
  vfwebqq = api.defaults('vfwebqq');
  log('psessionid', psessionid);
  log('client_id', client_id);
  log('ptwebqq', ptwebqq);
  log('uin', uin);
  log('vfwebqq', vfwebqq);
  log("长轮训");
  return api.long_poll(client_id, psessionid, function(ret) {
    return log(ret);
  });
};

test_long_pull();
```

Response:
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'
    client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'
    uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    log 'psessionid',psessionid
    log 'client_id',client_id
    log 'ptwebqq',ptwebqq
    log 'uin',uin
    log 'vfwebqq',vfwebqq

    log "长轮训"
    api.long_poll client_id , psessionid , (ret)->
        log ret

test_long_pull()


Prompt:
#!/usr/bin/env coffee

int = (v) -> parseInt v
log = console.log
auth = require "../src/qqauth"
api  = require "../src/qqapi"

config = require '../config'
qq = config.account
pass = config.password

test_long_pull = ->
    api.defaults_read()

    psessionid = api.defaults 'psessionid'

Response:
client_id  = api.defaults 'clientid'
    ptwebqq    = api.defaults 'ptwebqq'
    uin        = api.defaults 'uin'
    vfwebqq    = api.defaults 'vfwebqq'

    log 'psessionid',psessionid
    log 'client_id',client_id
    log 'ptwebqq',ptwebqq
    log 'uin',uin
    log 'vfwebqq',vfwebqq

    log "长轮训"
    api.long_poll client_id , psessionid , (ret)->
        log ret

test_long_pull()


Response:
$.paste = (pasteContainer) ->
  console?.log "DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead."
  pm = Paste.mountNonInputable pasteContainer
  pm._container


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
$.paste = (pasteContainer) ->
  console?.log "DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead."
  pm = Paste.mountNonInputable pasteContainer
  pm._container
```

Response:
$.paste = function(pasteContainer) {
  var pm;
  if (typeof console !== "undefined" && console !== null) {
    console.log("DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.");
  }
  pm = Paste.mountNonInputable(pasteContainer);
  return pm._container;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
$.paste = function(pasteContainer) {
  var pm;
  if (typeof console !== "undefined" && console !== null) {
    console.log("DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.");
  }
  pm = Paste.mountNonInputable(pasteContainer);
  return pm._container;
};
```

Response:
$.paste = (pasteContainer) ->
  console?.log "DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead."
  pm = Paste.mountNonInputable pasteContainer
  pm._container


Prompt:
$.paste = (pasteContainer) ->
  console?.log "DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead."

Response:
pm = Paste.mountNonInputable pasteContainer
  pm._container


Response:
$.fn.pastableNonInputable = ->
  for el in @
    Paste.mountNonInputable el
  @


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
$.fn.pastableNonInputable = ->
  for el in @
    Paste.mountNonInputable el
  @
```

Response:
$.fn.pastableNonInputable = function() {
  var el, i, len, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    Paste.mountNonInputable(el);
  }
  return this;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
$.fn.pastableNonInputable = function() {
  var el, i, len, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    Paste.mountNonInputable(el);
  }
  return this;
};
```

Response:
$.fn.pastableNonInputable = ->
  for el in @
    Paste.mountNonInputable el
  @


Prompt:
$.fn.pastableNonInputable = ->
  for el in @

Response:
Paste.mountNonInputable el
  @


Response:
$.fn.pastableTextarea = ->
  for el in @
    Paste.mountTextarea el
  @


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
$.fn.pastableTextarea = ->
  for el in @
    Paste.mountTextarea el
  @
```

Response:
$.fn.pastableTextarea = function() {
  var el, i, len, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    Paste.mountTextarea(el);
  }
  return this;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
$.fn.pastableTextarea = function() {
  var el, i, len, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    Paste.mountTextarea(el);
  }
  return this;
};
```

Response:
$.fn.pastableTextarea = ->
  for el in @
    Paste.mountTextarea el
  @


Prompt:
$.fn.pastableTextarea = ->
  for el in @

Response:
Paste.mountTextarea el
  @


Response:
$.fn.pastableContenteditable = ->
  for el in @
    Paste.mountContenteditable el
  @


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
$.fn.pastableContenteditable = ->
  for el in @
    Paste.mountContenteditable el
  @
```

Response:
$.fn.pastableContenteditable = function() {
  var el, i, len, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    Paste.mountContenteditable(el);
  }
  return this;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
$.fn.pastableContenteditable = function() {
  var el, i, len, ref;
  ref = this;
  for (i = 0, len = ref.length; i < len; i++) {
    el = ref[i];
    Paste.mountContenteditable(el);
  }
  return this;
};
```

Response:
$.fn.pastableContenteditable = ->
  for el in @
    Paste.mountContenteditable el
  @


Prompt:
$.fn.pastableContenteditable = ->
  for el in @

Response:
Paste.mountContenteditable el
  @


Response:
dataURLtoBlob = (dataURL, sliceSize=512) ->
  return null unless m = dataURL.match /^data\:([^\;]+)\;base64\,(.+)$/
  [m, contentType, b64Data] = m
  byteCharacters = atob(b64Data)
  byteArrays = []
  offset = 0
  while offset < byteCharacters.length
    slice = byteCharacters.slice(offset, offset + sliceSize)
    byteNumbers = new Array(slice.length)
    i = 0
    while i < slice.length
      byteNumbers[i] = slice.charCodeAt(i)
      i++
    byteArray = new Uint8Array(byteNumbers)
    byteArrays.push byteArray
    offset += sliceSize
  new Blob byteArrays,
    type: contentType


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
dataURLtoBlob = (dataURL, sliceSize=512) ->
  return null unless m = dataURL.match /^data\:([^\;]+)\;base64\,(.+)$/
  [m, contentType, b64Data] = m
  byteCharacters = atob(b64Data)
  byteArrays = []
  offset = 0
  while offset < byteCharacters.length
    slice = byteCharacters.slice(offset, offset + sliceSize)
    byteNumbers = new Array(slice.length)
    i = 0
    while i < slice.length
      byteNumbers[i] = slice.charCodeAt(i)
      i++
    byteArray = new Uint8Array(byteNumbers)
    byteArrays.push byteArray
    offset += sliceSize
  new Blob byteArrays,
    type: contentType
```

Response:
var dataURLtoBlob;

dataURLtoBlob = function(dataURL, sliceSize = 512) {
  var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice;
  if (!(m = dataURL.match(/^data\:([^\;]+)\;base64\,(.+)$/))) {
    return null;
  }
  [m, contentType, b64Data] = m;
  byteCharacters = atob(b64Data);
  byteArrays = [];
  offset = 0;
  while (offset < byteCharacters.length) {
    slice = byteCharacters.slice(offset, offset + sliceSize);
    byteNumbers = new Array(slice.length);
    i = 0;
    while (i < slice.length) {
      byteNumbers[i] = slice.charCodeAt(i);
      i++;
    }
    byteArray = new Uint8Array(byteNumbers);
    byteArrays.push(byteArray);
    offset += sliceSize;
  }
  return new Blob(byteArrays, {
    type: contentType
  });
};


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

dataURLtoBlob = function(dataURL, sliceSize = 512) {
  var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice;
  if (!(m = dataURL.match(/^data\:([^\;]+)\;base64\,(.+)$/))) {
    return null;
  }
  [m, contentType, b64Data] = m;
  byteCharacters = atob(b64Data);
  byteArrays = [];
  offset = 0;
  while (offset < byteCharacters.length) {
    slice = byteCharacters.slice(offset, offset + sliceSize);
    byteNumbers = new Array(slice.length);
    i = 0;
    while (i < slice.length) {
      byteNumbers[i] = slice.charCodeAt(i);
      i++;
    }
    byteArray = new Uint8Array(byteNumbers);
    byteArrays.push(byteArray);
    offset += sliceSize;
  }
  return new Blob(byteArrays, {
    type: contentType
  });
};
```

Response:
dataURLtoBlob = (dataURL, sliceSize=512) ->
  return null unless m = dataURL.match /^data\:([^\;]+)\;base64\,(.+)$/
  [m, contentType, b64Data] = m
  byteCharacters = atob(b64Data)
  byteArrays = []
  offset = 0
  while offset < byteCharacters.length
    slice = byteCharacters.slice(offset, offset + sliceSize)
    byteNumbers = new Array(slice.length)
    i = 0
    while i < slice.length
      byteNumbers[i] = slice.charCodeAt(i)
      i++
    byteArray = new Uint8Array(byteNumbers)
    byteArrays.push byteArray
    offset += sliceSize
  new Blob byteArrays,
    type: contentType


Prompt:
dataURLtoBlob = (dataURL, sliceSize=512) ->
  return null unless m = dataURL.match /^data\:([^\;]+)\;base64\,(.+)$/
  [m, contentType, b64Data] = m
  byteCharacters = atob(b64Data)
  byteArrays = []
  offset = 0
  while offset < byteCharacters.length
    slice = byteCharacters.slice(offset, offset + sliceSize)
    byteNumbers = new Array(slice.length)

Response:
i = 0
    while i < slice.length
      byteNumbers[i] = slice.charCodeAt(i)
      i++
    byteArray = new Uint8Array(byteNumbers)
    byteArrays.push byteArray
    offset += sliceSize
  new Blob byteArrays,
    type: contentType


Response:
createHiddenEditable = ->
  $(document.createElement 'div')
  .attr 'contenteditable', true
  .attr 'aria-hidden', true
  .attr 'tabindex', -1
  .css
    width: 1
    height: 1
    position: 'fixed'
    left: -100
    overflow: 'hidden'


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
createHiddenEditable = ->
  $(document.createElement 'div')
  .attr 'contenteditable', true
  .attr 'aria-hidden', true
  .attr 'tabindex', -1
  .css
    width: 1
    height: 1
    position: 'fixed'
    left: -100
    overflow: 'hidden'
```

Response:
var createHiddenEditable;

createHiddenEditable = function() {
  return $(document.createElement('div')).attr('contenteditable', true).attr('aria-hidden', true).attr('tabindex', -1).css({
    width: 1,
    height: 1,
    position: 'fixed',
    left: -100,
    overflow: 'hidden'
  });
};


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

createHiddenEditable = function() {
  return $(document.createElement('div')).attr('contenteditable', true).attr('aria-hidden', true).attr('tabindex', -1).css({
    width: 1,
    height: 1,
    position: 'fixed',
    left: -100,
    overflow: 'hidden'
  });
};
```

Response:
createHiddenEditable = ->
  $(document.createElement 'div')
  .attr 'contenteditable', true
  .attr 'aria-hidden', true
  .attr 'tabindex', -1
  .css
    width: 1
    height: 1
    position: 'fixed'
    left: -100
    overflow: 'hidden'


Prompt:
createHiddenEditable = ->
  $(document.createElement 'div')
  .attr 'contenteditable', true
  .attr 'aria-hidden', true
  .attr 'tabindex', -1

Response:
.css
    width: 1
    height: 1
    position: 'fixed'
    left: -100
    overflow: 'hidden'


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()
    $(paste._target).on 'pasteText', (ev, data)=>
      curStart = $(textarea).prop('selectionStart')
      curEnd = $(textarea).prop('selectionEnd')
      content = $(textarea).val()
      $(textarea).val "#{content[0...curStart]}#{data.text}#{content[curEnd...]}"
      $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length
      $(textarea).trigger 'change'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()
    $(paste._target).on 'pasteText', (ev, data)=>
      curStart = $(textarea).prop('selectionStart')
      curEnd = $(textarea).prop('selectionEnd')
      content = $(textarea).val()
      $(textarea).val "#{content[0...curStart]}#{data.text}#{content[curEnd...]}"
      $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length
      $(textarea).trigger 'change'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
```

Response:
var Paste;

Paste = (function() {
  class Paste {
    static mountNonInputable(nonInputable) {
      var paste;
      paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
      $(nonInputable).on('click', () => {
        return paste._container.focus();
      });
      paste._container.on('focus', () => {
        return $(nonInputable).addClass('pastable-focus');
      });
      return paste._container.on('blur', () => {
        return $(nonInputable).removeClass('pastable-focus');
      });
    }

    static mountTextarea(textarea) {
      var ctlDown, paste;
      if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
        // Firefox & IE
        return this.mountContenteditable(textarea);
      }
      paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
      ctlDown = false;
      $(textarea).on('keyup', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          return ctlDown = false;
        }
      });
      $(textarea).on('keydown', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          ctlDown = true;
        }
        if ((ev.ctrlKey != null) && (ev.metaKey != null)) {
          ctlDown = ev.ctrlKey || ev.metaKey;
        }
        if (ctlDown && ev.keyCode === 86) {
          return paste._container.focus();
        }
      });
      $(textarea).on('focus', () => {
        return $(textarea).addClass('pastable-focus');
      });
      $(textarea).on('blur', () => {
        return $(textarea).removeClass('pastable-focus');
      });
      $(paste._target).on('_pasteCheckContainerDone', () => {
        return $(textarea).focus();
      });
      return $(paste._target).on('pasteText', (ev, data) => {
        var content, curEnd, curStart;
        curStart = $(textarea).prop('selectionStart');
        curEnd = $(textarea).prop('selectionEnd');
        content = $(textarea).val();
        $(textarea).val(`${content.slice(0, curStart)}${data.text}${content.slice(curEnd)}`);
        $(textarea)[0].setSelectionRange(curStart + data.text.length, curStart + data.text.length);
        return $(textarea).trigger('change');
      });
    }

    static mountContenteditable(contenteditable) {
      var paste;
      paste = new Paste(contenteditable, contenteditable);
      $(contenteditable).on('focus', () => {
        return $(contenteditable).addClass('pastable-focus');
      });
      return $(contenteditable).on('blur', () => {
        return $(contenteditable).removeClass('pastable-focus');
      });
    }

    constructor(_container, _target) {
      this._container = _container;
      this._target = _target;
      this._container = $(this._container);
      this._target = $(this._target).addClass('pastable');
      this._container.on('paste', (ev) => {});
    }

  };

  // Element to receive final events.
  Paste.prototype._target = null;

  // Actual element to do pasting.
  Paste.prototype._container = null;

  return Paste;

}).call(this);


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

Paste = (function() {
  class Paste {
    static mountNonInputable(nonInputable) {
      var paste;
      paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
      $(nonInputable).on('click', () => {
        return paste._container.focus();
      });
      paste._container.on('focus', () => {
        return $(nonInputable).addClass('pastable-focus');
      });
      return paste._container.on('blur', () => {
        return $(nonInputable).removeClass('pastable-focus');
      });
    }

    static mountTextarea(textarea) {
      var ctlDown, paste;
      if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
        // Firefox & IE
        return this.mountContenteditable(textarea);
      }
      paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
      ctlDown = false;
      $(textarea).on('keyup', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          return ctlDown = false;
        }
      });
      $(textarea).on('keydown', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          ctlDown = true;
        }
        if ((ev.ctrlKey != null) && (ev.metaKey != null)) {
          ctlDown = ev.ctrlKey || ev.metaKey;
        }
        if (ctlDown && ev.keyCode === 86) {
          return paste._container.focus();
        }
      });
      $(textarea).on('focus', () => {
        return $(textarea).addClass('pastable-focus');
      });
      $(textarea).on('blur', () => {
        return $(textarea).removeClass('pastable-focus');
      });
      $(paste._target).on('_pasteCheckContainerDone', () => {
        return $(textarea).focus();
      });
      return $(paste._target).on('pasteText', (ev, data) => {
        var content, curEnd, curStart;
        curStart = $(textarea).prop('selectionStart');
        curEnd = $(textarea).prop('selectionEnd');
        content = $(textarea).val();
        $(textarea).val(`${content.slice(0, curStart)}${data.text}${content.slice(curEnd)}`);
        $(textarea)[0].setSelectionRange(curStart + data.text.length, curStart + data.text.length);
        return $(textarea).trigger('change');
      });
    }

    static mountContenteditable(contenteditable) {
      var paste;
      paste = new Paste(contenteditable, contenteditable);
      $(contenteditable).on('focus', () => {
        return $(contenteditable).addClass('pastable-focus');
      });
      return $(contenteditable).on('blur', () => {
        return $(contenteditable).removeClass('pastable-focus');
      });
    }

    constructor(_container, _target) {
      this._container = _container;
      this._target = _target;
      this._container = $(this._container);
      this._target = $(this._target).addClass('pastable');
      this._container.on('paste', (ev) => {});
    }

  };

  // Element to receive final events.
  Paste.prototype._target = null;

  // Actual element to do pasting.
  Paste.prototype._container = null;

  return Paste;

}).call(this);
```

Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()
    $(paste._target).on 'pasteText', (ev, data)=>
      curStart = $(textarea).prop('selectionStart')
      curEnd = $(textarea).prop('selectionEnd')
      content = $(textarea).val()
      $(textarea).val "#{content[0...curStart]}#{data.text}#{content[curEnd...]}"
      $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length
      $(textarea).trigger 'change'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>


Prompt:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?

Response:
paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()
    $(paste._target).on 'pasteText', (ev, data)=>
      curStart = $(textarea).prop('selectionStart')
      curEnd = $(textarea).prop('selectionEnd')
      content = $(textarea).val()
      $(textarea).val "#{content[0...curStart]}#{data.text}#{content[curEnd...]}"
      $(textarea)[0].setSelectionRange curStart + data.text.length, curStart + data.text.length
      $(textarea).trigger 'change'

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>


Response:
if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          setTimeout =>
            @_target.trigger 'pasteText', text: text
            @_target.trigger '_pasteCheckContainerDone'
          , 1
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
          @_checkImagesInContainer (src)->
      null

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL


Prompt:
if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
              reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          setTimeout =>
            @_target.trigger 'pasteText', text: text

Response:
@_target.trigger '_pasteCheckContainerDone'
          , 1
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
          @_checkImagesInContainer (src)->
      null

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL


Response:
@_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
      @_target.trigger '_pasteCheckContainerDone'
    , 1


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
@_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
      @_target.trigger '_pasteCheckContainerDone'
    , 1
```

Response:
this._target.trigger('pasteImage', {
  blob: blob,
  dataURL: dataURL,
  width: loader.width,
  height: loader.height
});

loader.onerror = () => {
  return this._target.trigger('pasteImageError', {
    message: `Failed to get image from: ${src}`,
    url: src
  });
};

loader.src = src;

({
  _checkImagesInContainer: function(cb) {
    var i, img, len, ref, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref = this._container.find('img');
    for (i = 0, len = ref.length; i < len; i++) {
      img = ref[i];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var j, len1, ref1;
      ref1 = this._container.find('img');
      for (j = 0, len1 = ref1.length; j < len1; j++) {
        img = ref1[j];
        if (!img[`_paste_marked_${timespan}`]) {
          cb(img.src);
        }
        $(img).remove();
      }
      return this._target.trigger('_pasteCheckContainerDone');
    }, 1);
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this._target.trigger('pasteImage', {
  blob: blob,
  dataURL: dataURL,
  width: loader.width,
  height: loader.height
});

loader.onerror = () => {
  return this._target.trigger('pasteImageError', {
    message: `Failed to get image from: ${src}`,
    url: src
  });
};

loader.src = src;

({
  _checkImagesInContainer: function(cb) {
    var i, img, len, ref, timespan;
    timespan = Math.floor(1000 * Math.random());
    ref = this._container.find('img');
    for (i = 0, len = ref.length; i < len; i++) {
      img = ref[i];
      img[`_paste_marked_${timespan}`] = true;
    }
    return setTimeout(() => {
      var j, len1, ref1;
      ref1 = this._container.find('img');
      for (j = 0, len1 = ref1.length; j < len1; j++) {
        img = ref1[j];
        if (!img[`_paste_marked_${timespan}`]) {
          cb(img.src);
        }
        $(img).remove();
      }
      return this._target.trigger('_pasteCheckContainerDone');
    }, 1);
  }
});
```

Response:
@_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

  _checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
      @_target.trigger '_pasteCheckContainerDone'
    , 1


Prompt:
@_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',
        message: "Failed to get image from: #{src}"
        url: src
    loader.src = src

Response:
_checkImagesInContainer: (cb)->
    timespan = Math.floor 1000 * Math.random()
    img["_paste_marked_#{timespan}"] = true for img in @_container.find('img')
    setTimeout =>
      for img in @_container.find('img')
        cb img.src unless img["_paste_marked_#{timespan}"]
        $(img).remove()
      @_target.trigger '_pasteCheckContainerDone'
    , 1


Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()
```

Response:
var Paste;

Paste = (function() {
  class Paste {
    static mountNonInputable(nonInputable) {
      var paste;
      paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
      $(nonInputable).on('click', () => {
        return paste._container.focus();
      });
      paste._container.on('focus', () => {
        return $(nonInputable).addClass('pastable-focus');
      });
      return paste._container.on('blur', () => {
        return $(nonInputable).removeClass('pastable-focus');
      });
    }

    static mountTextarea(textarea) {
      var ctlDown, paste;
      if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
        // Firefox & IE
        return this.mountContenteditable(textarea);
      }
      paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
      ctlDown = false;
      $(textarea).on('keyup', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          return ctlDown = false;
        }
      });
      $(textarea).on('keydown', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          ctlDown = true;
        }
        if ((ev.ctrlKey != null) && (ev.metaKey != null)) {
          ctlDown = ev.ctrlKey || ev.metaKey;
        }
        if (ctlDown && ev.keyCode === 86) {
          return paste._container.focus();
        }
      });
      $(textarea).on('focus', () => {
        return $(textarea).addClass('pastable-focus');
      });
      $(textarea).on('blur', () => {
        return $(textarea).removeClass('pastable-focus');
      });
      return $(paste._target).on('_pasteCheckContainerDone', () => {
        return $(textarea).focus();
      });
    }

    static mountContenteditable(contenteditable) {
      var paste;
      paste = new Paste(contenteditable, contenteditable);
      $(contenteditable).on('focus', () => {
        return $(contenteditable).addClass('pastable-focus');
      });
      return $(contenteditable).on('blur', () => {
        return $(contenteditable).removeClass('pastable-focus');
      });
    }

    constructor(_container, _target) {
      this._container = _container;
      this._target = _target;
      this._container = $(this._container);
      this._target = $(this._target).addClass('pastable');
      this._container.on('paste', (ev) => {
        var clipboardData, i, item, len, reader, ref, ref1, results;
        if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {
          clipboardData = ev.originalEvent.clipboardData;
          if (clipboardData.items) {
            ref1 = clipboardData.items;
            // Chrome
            results = [];
            for (i = 0, len = ref1.length; i < len; i++) {
              item = ref1[i];
              if (item.type.match(/^image\//)) {
                results.push(reader = new FileReader());
              } else {
                results.push(void 0);
              }
            }
            return results;
          }
        }
      });
    }

  };

  // Element to receive final events.
  Paste.prototype._target = null;

  // Actual element to do pasting.
  Paste.prototype._container = null;

  return Paste;

}).call(this);


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

Paste = (function() {
  class Paste {
    static mountNonInputable(nonInputable) {
      var paste;
      paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
      $(nonInputable).on('click', () => {
        return paste._container.focus();
      });
      paste._container.on('focus', () => {
        return $(nonInputable).addClass('pastable-focus');
      });
      return paste._container.on('blur', () => {
        return $(nonInputable).removeClass('pastable-focus');
      });
    }

    static mountTextarea(textarea) {
      var ctlDown, paste;
      if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
        // Firefox & IE
        return this.mountContenteditable(textarea);
      }
      paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
      ctlDown = false;
      $(textarea).on('keyup', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          return ctlDown = false;
        }
      });
      $(textarea).on('keydown', function(ev) {
        var ref;
        if ((ref = ev.keyCode) === 17 || ref === 224) {
          ctlDown = true;
        }
        if ((ev.ctrlKey != null) && (ev.metaKey != null)) {
          ctlDown = ev.ctrlKey || ev.metaKey;
        }
        if (ctlDown && ev.keyCode === 86) {
          return paste._container.focus();
        }
      });
      $(textarea).on('focus', () => {
        return $(textarea).addClass('pastable-focus');
      });
      $(textarea).on('blur', () => {
        return $(textarea).removeClass('pastable-focus');
      });
      return $(paste._target).on('_pasteCheckContainerDone', () => {
        return $(textarea).focus();
      });
    }

    static mountContenteditable(contenteditable) {
      var paste;
      paste = new Paste(contenteditable, contenteditable);
      $(contenteditable).on('focus', () => {
        return $(contenteditable).addClass('pastable-focus');
      });
      return $(contenteditable).on('blur', () => {
        return $(contenteditable).removeClass('pastable-focus');
      });
    }

    constructor(_container, _target) {
      this._container = _container;
      this._target = _target;
      this._container = $(this._container);
      this._target = $(this._target).addClass('pastable');
      this._container.on('paste', (ev) => {
        var clipboardData, i, item, len, reader, ref, ref1, results;
        if (((ref = ev.originalEvent) != null ? ref.clipboardData : void 0) != null) {
          clipboardData = ev.originalEvent.clipboardData;
          if (clipboardData.items) {
            ref1 = clipboardData.items;
            // Chrome
            results = [];
            for (i = 0, len = ref1.length; i < len; i++) {
              item = ref1[i];
              if (item.type.match(/^image\//)) {
                results.push(reader = new FileReader());
              } else {
                results.push(void 0);
              }
            }
            return results;
          }
        }
      });
    }

  };

  // Element to receive final events.
  Paste.prototype._target = null;

  // Actual element to do pasting.
  Paste.prototype._container = null;

  return Paste;

}).call(this);
```

Response:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?
      paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()


Prompt:
class Paste
  # Element to receive final events.
  _target: null

  # Actual element to do pasting.
  _container: null

  @mountNonInputable: (nonInputable)->
    paste = new Paste createHiddenEditable().appendTo(nonInputable), nonInputable
    $(nonInputable).on 'click', => paste._container.focus()

    paste._container.on 'focus', => $(nonInputable).addClass 'pastable-focus'
    paste._container.on 'blur', => $(nonInputable).removeClass 'pastable-focus'

  @mountTextarea: (textarea)->
    # Firefox & IE
    return @mountContenteditable textarea if -1 != navigator.userAgent.toLowerCase().indexOf('chrome')
    paste = new Paste createHiddenEditable().insertBefore(textarea), textarea
    ctlDown = false
    $(textarea).on 'keyup', (ev)->
      ctlDown = false if ev.keyCode in [17, 224]
    $(textarea).on 'keydown', (ev)->
      ctlDown = true if ev.keyCode in [17, 224]
      ctlDown = ev.ctrlKey || ev.metaKey if ev.ctrlKey? && ev.metaKey?

Response:
paste._container.focus() if ctlDown && ev.keyCode == 86
    $(textarea).on 'focus', => $(textarea).addClass 'pastable-focus'
    $(textarea).on 'blur', => $(textarea).removeClass 'pastable-focus'
    $(paste._target).on '_pasteCheckContainerDone', => $(textarea).focus()

  @mountContenteditable: (contenteditable)->
    paste = new Paste contenteditable, contenteditable

    $(contenteditable).on 'focus', => $(contenteditable).addClass 'pastable-focus'
    $(contenteditable).on 'blur', => $(contenteditable).removeClass 'pastable-focus'

  constructor: (@_container, @_target)->
    @_container = $ @_container
    @_target = $ @_target
    .addClass 'pastable'
    @_container.on 'paste', (ev)=>
      if ev.originalEvent?.clipboardData?
        clipboardData = ev.originalEvent.clipboardData
        if clipboardData.items
          # Chrome
          for item in clipboardData.items
            if item.type.match /^image\//
              reader = new FileReader()


Response:
reader.onload = (event)=>
                @_handleImage event.target.result
              reader.readAsDataURL item.getAsFile()
            if item.type == 'text/plain'
              item.getAsString (string)=>
                @_target.trigger 'pasteText', text: string
        else
          # Firefox & Safari(text-only)
          if -1 != Array.prototype.indexOf.call clipboardData.types, 'text/plain'
            text = clipboardData.getData 'Text'
            @_target.trigger 'pasteText', text: text
          @_checkImagesInContainer (src)=>
            @_handleImage src
      # IE
      if clipboardData = window.clipboardData
        if (text = clipboardData.getData 'Text')?.length
          setTimeout =>
            @_target.trigger 'pasteText', text: text
            @_target.trigger '_pasteCheckContainerDone'
          , 1
        else
          for file in clipboardData.files
            @_handleImage URL.createObjectURL(file)
          @_checkImagesInContainer (src)->
      null

  _handleImage: (src)->
    if src.match /^webkit\-fake\-url\:\/\//
      return @_target.trigger 'pasteImageError',
        message: "You are trying to paste an image in Safari, however we are unable to retieve its data."
    loader = new Image()
    loader.crossOrigin = "anonymous"
    loader.onload = =>
      canvas = document.createElement 'canvas'
      canvas.width = loader.width
      canvas.height = loader.height
      ctx = canvas.getContext '2d'
      ctx.drawImage loader, 0, 0, canvas.width, canvas.height
      dataURL = null
      try
        dataURL = canvas.toDataURL 'image/png'
        blob = dataURLtoBlob dataURL
      if dataURL
        @_target.trigger 'pasteImage',
          blob: blob
          dataURL: dataURL
          width: loader.width
          height: loader.height
    loader.onerror = =>
      @_target.trigger 'pasteImageError',