Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 50 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data
           .on 'complete', (err) ->
             callback err if err instanceof Error

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
```

Response:
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 50 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    }).on('complete', function(err) {
      if (err instanceof Error) {
        return callback(err);
      }
    });
  },
  checkApiLimit: function(callback) {
    return restler.get(generateApiUrl("/users/whatever")).on('success', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    }).on('fail', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    });
  }
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 50 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    }).on('complete', function(err) {
      if (err instanceof Error) {
        return callback(err);
      }
    });
  },
  checkApiLimit: function(callback) {
    return restler.get(generateApiUrl("/users/whatever")).on('success', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    }).on('fail', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    });
  }
};
```

Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 50 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data
           .on 'complete', (err) ->
             callback err if err instanceof Error

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']


Prompt:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

Response:
repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 50 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data
           .on 'complete', (err) ->
             callback err if err instanceof Error

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']


Response:
# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"
```

Response:
// private
var generateApiUrl;

generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// private
var generateApiUrl;

generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};
```

Response:
# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 50 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 50 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->
```

Response:
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 50 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  },
  checkApiLimit: function(callback) {
    return restler.get(generateApiUrl("/users/whatever")).on('success', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    }).on('fail', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    });
  }
};

// private
generateApiUrl = function(url) {};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 50 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  },
  checkApiLimit: function(callback) {
    return restler.get(generateApiUrl("/users/whatever")).on('success', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    }).on('fail', function(data, res) {
      logger.debug(`API rate ramained ${res.headers['x-ratelimit-remaining']}`);
      return callback(res.headers['x-ratelimit-remaining']);
    });
  }
};

// private
generateApiUrl = function(url) {};
```

Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 50 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->


Prompt:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

Response:
repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 50 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              logger.debug "API rate ramained #{res.headers['x-ratelimit-remaining']}"
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->


Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              console.log('success');
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              console.log('fail');
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              console.log('success');
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              console.log('fail');
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->
```

Response:
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 100 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  },
  checkApiLimit: function(callback) {
    return restler.get(generateApiUrl("/users/whatever")).on('success', function(data, res) {
      console.log('success');
      return callback(res.headers['x-ratelimit-remaining']);
    }).on('fail', function(data, res) {
      console.log('fail');
      return callback(res.headers['x-ratelimit-remaining']);
    });
  }
};

// private
generateApiUrl = function(url) {};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 100 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  },
  checkApiLimit: function(callback) {
    return restler.get(generateApiUrl("/users/whatever")).on('success', function(data, res) {
      console.log('success');
      return callback(res.headers['x-ratelimit-remaining']);
    }).on('fail', function(data, res) {
      console.log('fail');
      return callback(res.headers['x-ratelimit-remaining']);
    });
  }
};

// private
generateApiUrl = function(url) {};
```

Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              console.log('success');
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              console.log('fail');
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->


Prompt:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

Response:
repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

  checkApiLimit: (callback) ->
    restler.get(generateApiUrl "/users/whatever")
           .on 'success', (data, res) ->
              console.log('success');
              callback res.headers['x-ratelimit-remaining']
           .on 'fail', (data, res) ->
              console.log('fail');
              callback res.headers['x-ratelimit-remaining']

# private
generateApiUrl = (url) ->


Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"
```

Response:
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 100 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  }
};

// private
generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      if (res.headers['x-ratelimit-remaining'] % 100 === 0) {
        //'x-ratelimit-limit': '5000',
        //'x-ratelimit-remaining': '4986',
        logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  }
};

// private
generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};
```

Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =

Response:
getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] % 100 is 0
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}"
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}"
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"
```

Response:
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      //'x-ratelimit-limit': '5000',
      //'x-ratelimit-remaining': '4986',
      logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  }
};

// private
generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, logger, path, postfix, restler, tl, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

logger = helpers.logger;

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

tl = module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      //'x-ratelimit-limit': '5000',
      //'x-ratelimit-remaining': '4986',
      logger.info(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      if (res.headers['x-ratelimit-remaining'] < '10') {
        logger.error(`github api limit: ${res.headers['x-ratelimit-remaining']}`);
      }
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      return callback(data);
    });
  }
};

// private
generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};
```

Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}"
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'
logger = helpers.logger

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

tl = module.exports =

Response:
getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             #'x-ratelimit-limit': '5000',
             #'x-ratelimit-remaining': '4986',
             logger.info "github api limit: #{res.headers['x-ratelimit-remaining']}"
             logger.error "github api limit: #{res.headers['x-ratelimit-remaining']}" if res.headers['x-ratelimit-remaining'] < '10'
             callback null, data, res
           .on 'fail', (data, res) ->
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"
```

Response:
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, path, postfix, restler, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      console.log(`${res.statusCode}:`, data);
      return callback(data);
    });
  }
};

// private
generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var fs, generateApiUrl, githubHost, helpers, path, postfix, restler, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

helpers = require('./helpers');

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === helpers.extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      console.log(`${res.statusCode}:`, data);
      return callback(data);
    });
  }
};

// private
generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};
```

Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'
helpers = require './helpers'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

Response:
module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse timeline if 'string' is helpers.extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse(timeline) if 'string' is extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
extractType = (target) ->
  Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()

generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse(timeline) if 'string' is extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
extractType = (target) ->
  Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()

generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"
```

Response:
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var extractType, fs, generateApiUrl, githubHost, path, postfix, restler, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      console.log(`${res.statusCode}:`, data);
      return callback(data);
    });
  }
};

// private
extractType = function(target) {
  return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();
};

generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
// # Handle github timeline

// Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
// Licensed under the MIT license.
// <http://outsider.mit-license.org/>
var extractType, fs, generateApiUrl, githubHost, path, postfix, restler, token, tokenPath;

restler = require('restler');

path = require('path');

fs = require('fs');

githubHost = 'https://api.github.com';

// github.json contained token should be in .tokens directory
// ex: { "cliendId": "", "clientSecret": "" }
// WARRING: MUST NOT commit github.json file
tokenPath = path.resolve(`${__dirname}`, "../.tokens");

token = JSON.parse(fs.readFileSync(`${tokenPath}/github.json`, 'utf8'));

postfix = `?client_id=${token.cliendId}&client_secret=${token.clientSecret}`;

module.exports = {
  getCommitUrls: function(timeline) {
    var i, len, ref, repo, results, sha;
    if ('string' === extractType(timeline)) {
      // GET /repos/:owner/:repo/commits/:sha
      timeline = JSON.parse(timeline);
    }
    repo = timeline.repository;
    ref = timeline.payload.shas;
    results = [];
    for (i = 0, len = ref.length; i < len; i++) {
      sha = ref[i];
      results.push(`/repos/${repo.owner}/${repo.name}/commits/${sha[0]}`);
    }
    return results;
  },
  getCommitInfo: function(url, callback) {
    return restler.get(generateApiUrl(url)).on('success', function(data, res) {
      return callback(null, data, res);
    }).on('fail', function(data, res) {
      console.log(`${res.statusCode}:`, data);
      return callback(data);
    });
  }
};

// private
extractType = function(target) {
  return Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase();
};

generateApiUrl = function(url) {
  return `${githubHost}${url}${postfix}`;
};
```

Response:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

module.exports =
  getCommitUrls: (timeline) ->
    # GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse(timeline) if 'string' is extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
extractType = (target) ->
  Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()

generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Prompt:
# # Handle github timeline
#
# Copyright (c) 2013 JeongHoon Byun aka "Outsider", <http://blog.outsider.ne.kr/>
# Licensed under the MIT license.
# <http://outsider.mit-license.org/>

restler = require 'restler'
path = require 'path'
fs = require 'fs'

githubHost = 'https://api.github.com'
# github.json contained token should be in .tokens directory
# ex: { "cliendId": "", "clientSecret": "" }
# WARRING: MUST NOT commit github.json file
tokenPath = path.resolve "#{__dirname}", "../.tokens"
token = JSON.parse(fs.readFileSync "#{tokenPath}/github.json", 'utf8')
postfix = "?client_id=#{token.cliendId}&client_secret=#{token.clientSecret}"

module.exports =
  getCommitUrls: (timeline) ->

Response:
# GET /repos/:owner/:repo/commits/:sha
    timeline = JSON.parse(timeline) if 'string' is extractType timeline

    repo = timeline.repository
    "/repos/#{repo.owner}/#{repo.name}/commits/#{sha[0]}" for sha in timeline.payload.shas

  getCommitInfo: (url, callback) ->
    restler.get(generateApiUrl url)
           .on 'success', (data, res) ->
             callback null, data, res
           .on 'fail', (data, res) ->
             console.log "#{res.statusCode}:", data
             callback data

# private
extractType = (target) ->
  Object.prototype.toString.call(target).replace('[object ', '').replace(']', '').toLowerCase()

generateApiUrl = (url) ->
  "#{githubHost}#{url}#{postfix}"


Response:
module.exports = React.createClass
  displayName: 'form-file'

  propTypes:
    data: T.instanceOf(Immutable.Map)
    onChange: T.func
    onSubmit: T.func
    readOnly: T.bool
    imageWidth: T.number
    onUploaded: T.func
    willSubmit: T.bool
    imageHeight: T.number
    displayMode: T.oneOf([ 'create', 'edit' ]).isRequired
    onDelete: T.func
    onImageClick: T.func

  getDefaultProps: ->
    onChange: (->)
    onDelete: (->)
    onSubmit: (->)
    onImageClick: (->)
    readOnly: false
    imageWidth: 600
    onUploaded: (->)
    willSubmit: false
    imageHeight: 400

  getInitialState: ->
    data: @props.data or Immutable.Map PROTO_DATA
    isUploaded: @props.data?

  componentWillReceiveProps: (nextProps) ->
    if not @props.willSubmit and nextProps.willSubmit
      @props.onSubmit @state.data

    if not nextProps.data?
      @setState
        data: Immutable.Map PROTO_DATA
        isUploaded: false

    if @props.displayMode is 'edit'
      if not @props.readOnly and nextProps.readOnly
        @setState
          data: @props.data or Immutable.Map PROTO_DATA
          isUploaded: @props.data?

  getPreviewSize: ->
    @refs.preview?.getBoundingClientRect() or {}

  isFileClickable: ->


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
module.exports = React.createClass
  displayName: 'form-file'

  propTypes:
    data: T.instanceOf(Immutable.Map)
    onChange: T.func
    onSubmit: T.func
    readOnly: T.bool
    imageWidth: T.number
    onUploaded: T.func
    willSubmit: T.bool
    imageHeight: T.number
    displayMode: T.oneOf([ 'create', 'edit' ]).isRequired
    onDelete: T.func
    onImageClick: T.func

  getDefaultProps: ->
    onChange: (->)
    onDelete: (->)
    onSubmit: (->)
    onImageClick: (->)
    readOnly: false
    imageWidth: 600
    onUploaded: (->)
    willSubmit: false
    imageHeight: 400

  getInitialState: ->
    data: @props.data or Immutable.Map PROTO_DATA
    isUploaded: @props.data?

  componentWillReceiveProps: (nextProps) ->
    if not @props.willSubmit and nextProps.willSubmit
      @props.onSubmit @state.data

    if not nextProps.data?
      @setState
        data: Immutable.Map PROTO_DATA
        isUploaded: false

    if @props.displayMode is 'edit'
      if not @props.readOnly and nextProps.readOnly
        @setState
          data: @props.data or Immutable.Map PROTO_DATA
          isUploaded: @props.data?

  getPreviewSize: ->
    @refs.preview?.getBoundingClientRect() or {}

  isFileClickable: ->
```

Response:
module.exports = React.createClass({
  displayName: 'form-file',
  propTypes: {
    data: T.instanceOf(Immutable.Map),
    onChange: T.func,
    onSubmit: T.func,
    readOnly: T.bool,
    imageWidth: T.number,
    onUploaded: T.func,
    willSubmit: T.bool,
    imageHeight: T.number,
    displayMode: T.oneOf(['create', 'edit']).isRequired,
    onDelete: T.func,
    onImageClick: T.func
  },
  getDefaultProps: function() {
    return {
      onChange: (function() {}),
      onDelete: (function() {}),
      onSubmit: (function() {}),
      onImageClick: (function() {}),
      readOnly: false,
      imageWidth: 600,
      onUploaded: (function() {}),
      willSubmit: false,
      imageHeight: 400
    };
  },
  getInitialState: function() {
    return {
      data: this.props.data || Immutable.Map(PROTO_DATA),
      isUploaded: this.props.data != null
    };
  },
  componentWillReceiveProps: function(nextProps) {
    if (!this.props.willSubmit && nextProps.willSubmit) {
      this.props.onSubmit(this.state.data);
    }
    if (nextProps.data == null) {
      this.setState({
        data: Immutable.Map(PROTO_DATA),
        isUploaded: false
      });
    }
    if (this.props.displayMode === 'edit') {
      if (!this.props.readOnly && nextProps.readOnly) {
        return this.setState({
          data: this.props.data || Immutable.Map(PROTO_DATA),
          isUploaded: this.props.data != null
        });
      }
    }
  },
  getPreviewSize: function() {
    var ref;
    return ((ref = this.refs.preview) != null ? ref.getBoundingClientRect() : void 0) || {};
  },
  isFileClickable: function() {}
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
module.exports = React.createClass({
  displayName: 'form-file',
  propTypes: {
    data: T.instanceOf(Immutable.Map),
    onChange: T.func,
    onSubmit: T.func,
    readOnly: T.bool,
    imageWidth: T.number,
    onUploaded: T.func,
    willSubmit: T.bool,
    imageHeight: T.number,
    displayMode: T.oneOf(['create', 'edit']).isRequired,
    onDelete: T.func,
    onImageClick: T.func
  },
  getDefaultProps: function() {
    return {
      onChange: (function() {}),
      onDelete: (function() {}),
      onSubmit: (function() {}),
      onImageClick: (function() {}),
      readOnly: false,
      imageWidth: 600,
      onUploaded: (function() {}),
      willSubmit: false,
      imageHeight: 400
    };
  },
  getInitialState: function() {
    return {
      data: this.props.data || Immutable.Map(PROTO_DATA),
      isUploaded: this.props.data != null
    };
  },
  componentWillReceiveProps: function(nextProps) {
    if (!this.props.willSubmit && nextProps.willSubmit) {
      this.props.onSubmit(this.state.data);
    }
    if (nextProps.data == null) {
      this.setState({
        data: Immutable.Map(PROTO_DATA),
        isUploaded: false
      });
    }
    if (this.props.displayMode === 'edit') {
      if (!this.props.readOnly && nextProps.readOnly) {
        return this.setState({
          data: this.props.data || Immutable.Map(PROTO_DATA),
          isUploaded: this.props.data != null
        });
      }
    }
  },
  getPreviewSize: function() {
    var ref;
    return ((ref = this.refs.preview) != null ? ref.getBoundingClientRect() : void 0) || {};
  },
  isFileClickable: function() {}
});
```

Response:
module.exports = React.createClass
  displayName: 'form-file'

  propTypes:
    data: T.instanceOf(Immutable.Map)
    onChange: T.func
    onSubmit: T.func
    readOnly: T.bool
    imageWidth: T.number
    onUploaded: T.func
    willSubmit: T.bool
    imageHeight: T.number
    displayMode: T.oneOf([ 'create', 'edit' ]).isRequired
    onDelete: T.func
    onImageClick: T.func

  getDefaultProps: ->
    onChange: (->)
    onDelete: (->)
    onSubmit: (->)
    onImageClick: (->)
    readOnly: false
    imageWidth: 600
    onUploaded: (->)
    willSubmit: false
    imageHeight: 400

  getInitialState: ->
    data: @props.data or Immutable.Map PROTO_DATA
    isUploaded: @props.data?

  componentWillReceiveProps: (nextProps) ->
    if not @props.willSubmit and nextProps.willSubmit
      @props.onSubmit @state.data

    if not nextProps.data?
      @setState
        data: Immutable.Map PROTO_DATA
        isUploaded: false

    if @props.displayMode is 'edit'
      if not @props.readOnly and nextProps.readOnly
        @setState
          data: @props.data or Immutable.Map PROTO_DATA
          isUploaded: @props.data?

  getPreviewSize: ->
    @refs.preview?.getBoundingClientRect() or {}

  isFileClickable: ->


Prompt:
module.exports = React.createClass
  displayName: 'form-file'

  propTypes:
    data: T.instanceOf(Immutable.Map)
    onChange: T.func
    onSubmit: T.func
    readOnly: T.bool
    imageWidth: T.number
    onUploaded: T.func
    willSubmit: T.bool
    imageHeight: T.number
    displayMode: T.oneOf([ 'create', 'edit' ]).isRequired
    onDelete: T.func
    onImageClick: T.func

  getDefaultProps: ->
    onChange: (->)
    onDelete: (->)
    onSubmit: (->)
    onImageClick: (->)
    readOnly: false
    imageWidth: 600
    onUploaded: (->)
    willSubmit: false

Response:
imageHeight: 400

  getInitialState: ->
    data: @props.data or Immutable.Map PROTO_DATA
    isUploaded: @props.data?

  componentWillReceiveProps: (nextProps) ->
    if not @props.willSubmit and nextProps.willSubmit
      @props.onSubmit @state.data

    if not nextProps.data?
      @setState
        data: Immutable.Map PROTO_DATA
        isUploaded: false

    if @props.displayMode is 'edit'
      if not @props.readOnly and nextProps.readOnly
        @setState
          data: @props.data or Immutable.Map PROTO_DATA
          isUploaded: @props.data?

  getPreviewSize: ->
    @refs.preview?.getBoundingClientRect() or {}

  isFileClickable: ->


Response:
@props.readOnly and detect.isImageWithPreview(@props.data)

  willChange: (key, value) ->
    newState =
      data: @state.data.set key, value

    @setState newState
    @props.onChange newState.data

  handleFileDelete: (event) ->
    event.stopPropagation()

    newState =
      data: Immutable.Map PROTO_DATA
      isUploaded: false

    @setState newState
    @props.onChange newState.data
    @props.onDelete()

  handleFileView: (event) ->

  handleFileComplete: (uploadedData) ->
    newState =
      data: Immutable.Map uploadedData
      isUploaded: true

    @setState newState
    @props.onChange newState.data
    @props.onUploaded()

  handleFileNameChange: (event) ->
    @willChange 'fileName', event.target.value

  handleTextChange: (event) ->
    @willChange 'text', event.target.value

  onFormSubmit: (event) ->
    event.preventDefault()
    @props.onSubmit @state.data

  renderPreview: ->
    imageWidth = @props.imageWidth
    imageHeight = @props.imageHeight
    thumbnailUrl = @state.data.get 'thumbnailUrl'

    isWidther = @state.data.get('imageWidth') > imageWidth
    isHeighter = @state.data.get('imageHeight') > imageHeight


Prompt:
Convert this CoffeeScript to JavaScript.
```coffeescript
@props.readOnly and detect.isImageWithPreview(@props.data)

  willChange: (key, value) ->
    newState =
      data: @state.data.set key, value

    @setState newState
    @props.onChange newState.data

  handleFileDelete: (event) ->
    event.stopPropagation()

    newState =
      data: Immutable.Map PROTO_DATA
      isUploaded: false

    @setState newState
    @props.onChange newState.data
    @props.onDelete()

  handleFileView: (event) ->

  handleFileComplete: (uploadedData) ->
    newState =
      data: Immutable.Map uploadedData
      isUploaded: true

    @setState newState
    @props.onChange newState.data
    @props.onUploaded()

  handleFileNameChange: (event) ->
    @willChange 'fileName', event.target.value

  handleTextChange: (event) ->
    @willChange 'text', event.target.value

  onFormSubmit: (event) ->
    event.preventDefault()
    @props.onSubmit @state.data

  renderPreview: ->
    imageWidth = @props.imageWidth
    imageHeight = @props.imageHeight
    thumbnailUrl = @state.data.get 'thumbnailUrl'

    isWidther = @state.data.get('imageWidth') > imageWidth
    isHeighter = @state.data.get('imageHeight') > imageHeight
```

Response:
this.props.readOnly && detect.isImageWithPreview(this.props.data)({
  willChange: function(key, value) {
    var newState;
    newState = {
      data: this.state.data.set(key, value)
    };
    this.setState(newState);
    return this.props.onChange(newState.data);
  },
  handleFileDelete: function(event) {
    var newState;
    event.stopPropagation();
    newState = {
      data: Immutable.Map(PROTO_DATA),
      isUploaded: false
    };
    this.setState(newState);
    this.props.onChange(newState.data);
    return this.props.onDelete();
  },
  handleFileView: function(event) {},
  handleFileComplete: function(uploadedData) {
    var newState;
    newState = {
      data: Immutable.Map(uploadedData),
      isUploaded: true
    };
    this.setState(newState);
    this.props.onChange(newState.data);
    return this.props.onUploaded();
  },
  handleFileNameChange: function(event) {
    return this.willChange('fileName', event.target.value);
  },
  handleTextChange: function(event) {
    return this.willChange('text', event.target.value);
  },
  onFormSubmit: function(event) {
    event.preventDefault();
    return this.props.onSubmit(this.state.data);
  },
  renderPreview: function() {
    var imageHeight, imageWidth, isHeighter, isWidther, thumbnailUrl;
    imageWidth = this.props.imageWidth;
    imageHeight = this.props.imageHeight;
    thumbnailUrl = this.state.data.get('thumbnailUrl');
    isWidther = this.state.data.get('imageWidth') > imageWidth;
    return isHeighter = this.state.data.get('imageHeight') > imageHeight;
  }
});


Prompt:
Convert this JavaScript to CoffeeScript.
```javascript
this.props.readOnly && detect.isImageWithPreview(this.props.data)({
  willChange: function(key, value) {
    var newState;
    newState = {
      data: this.state.data.set(key, value)
    };
    this.setState(newState);
    return this.props.onChange(newState.data);
  },
  handleFileDelete: function(event) {
    var newState;
    event.stopPropagation();
    newState = {
      data: Immutable.Map(PROTO_DATA),
      isUploaded: false
    };
    this.setState(newState);
    this.props.onChange(newState.data);
    return this.props.onDelete();
  },
  handleFileView: function(event) {},
  handleFileComplete: function(uploadedData) {
    var newState;
    newState = {
      data: Immutable.Map(uploadedData),
      isUploaded: true
    };
    this.setState(newState);
    this.props.onChange(newState.data);
    return this.props.onUploaded();
  },
  handleFileNameChange: function(event) {
    return this.willChange('fileName', event.target.value);
  },
  handleTextChange: function(event) {
    return this.willChange('text', event.target.value);
  },
  onFormSubmit: function(event) {
    event.preventDefault();
    return this.props.onSubmit(this.state.data);
  },
  renderPreview: function() {
    var imageHeight, imageWidth, isHeighter, isWidther, thumbnailUrl;
    imageWidth = this.props.imageWidth;
    imageHeight = this.props.imageHeight;
    thumbnailUrl = this.state.data.get('thumbnailUrl');
    isWidther = this.state.data.get('imageWidth') > imageWidth;
    return isHeighter = this.state.data.get('imageHeight') > imageHeight;
  }
});
```

Response:
@props.readOnly and detect.isImageWithPreview(@props.data)

  willChange: (key, value) ->
    newState =
      data: @state.data.set key, value

    @setState newState
    @props.onChange newState.data

  handleFileDelete: (event) ->
    event.stopPropagation()

    newState =
      data: Immutable.Map PROTO_DATA
      isUploaded: false

    @setState newState
    @props.onChange newState.data
    @props.onDelete()

  handleFileView: (event) ->

  handleFileComplete: (uploadedData) ->
    newState =
      data: Immutable.Map uploadedData
      isUploaded: true

    @setState newState
    @props.onChange newState.data
    @props.onUploaded()

  handleFileNameChange: (event) ->
    @willChange 'fileName', event.target.value

  handleTextChange: (event) ->
    @willChange 'text', event.target.value

  onFormSubmit: (event) ->
    event.preventDefault()
    @props.onSubmit @state.data

  renderPreview: ->
    imageWidth = @props.imageWidth
    imageHeight = @props.imageHeight
    thumbnailUrl = @state.data.get 'thumbnailUrl'

    isWidther = @state.data.get('imageWidth') > imageWidth
    isHeighter = @state.data.get('imageHeight') > imageHeight


Prompt:
@props.readOnly and detect.isImageWithPreview(@props.data)

  willChange: (key, value) ->
    newState =
      data: @state.data.set key, value

    @setState newState
    @props.onChange newState.data

  handleFileDelete: (event) ->
    event.stopPropagation()

    newState =
      data: Immutable.Map PROTO_DATA
      isUploaded: false

    @setState newState
    @props.onChange newState.data
    @props.onDelete()

  handleFileView: (event) ->

  handleFileComplete: (uploadedData) ->
    newState =

Response:
data: Immutable.Map uploadedData
      isUploaded: true

    @setState newState
    @props.onChange newState.data
    @props.onUploaded()

  handleFileNameChange: (event) ->
    @willChange 'fileName', event.target.value

  handleTextChange: (event) ->
    @willChange 'text', event.target.value

  onFormSubmit: (event) ->
    event.preventDefault()
    @props.onSubmit @state.data

  renderPreview: ->
    imageWidth = @props.imageWidth
    imageHeight = @props.imageHeight
    thumbnailUrl = @state.data.get 'thumbnailUrl'

    isWidther = @state.data.get('imageWidth') > imageWidth
    isHeighter = @state.data.get('imageHeight') > imageHeight


Response:
isCover = isWidther and isHeighter

    url = constraint.thumbnail thumbnailUrl, imageHeight, imageWidth
    style = if url? then backgroundImage: "url(#{ url })" else {}

    div className: cx('preview', 'is-cover': isCover), style: style

  renderExtension: ->
    fileType = @state.data.get 'fileType'

    div className: 'extension',
      i className: 'ti ti-file-holder'
      span {}, fileType

  render: ->
    cxView = cx 'file-view', 'is-clickable': @isFileClickable()

    onFileClick = =>
      if @isFileClickable()
        @props.onImageClick()

    form className: cx('form-table', 'is-dashed': not @state.isUploaded), onSubmit: @onFormSubmit,
      if @state.isUploaded
        div className: cxView, onClick: onFileClick,
          if @state.data.get('fileCategory').length is 0
            noscript()
          else if detect.isImageWithPreview(@state.data)
            @renderPreview()
          else
            @renderExtension()
          span className: 'btn-group',
            if not @props.readOnly
              a className: 'btn btn-delete', onClick: @handleFileDelete,
                Icon size: 18, name: 'trash'
            else noscript()

            # Disable file preview for a while.
            # if @props.displayMode isnt 'create'
              # a className: 'btn btn-view', onClick: @handleFileView,
                # Icon size: 18, name: 'search'
            # else noscript()
      else noscript()
      fieldset {},
        if not @state.isUploaded
          Uploader
            data: @state.data
            onComplete: @handleFileComplete
        else noscript()
        div className: 'form-row', hidden: not @state.isUploaded,
          input


Prompt:
isCover = isWidther and isHeighter

    url = constraint.thumbnail thumbnailUrl, imageHeight, imageWidth
    style = if url? then backgroundImage: "url(#{ url })" else {}

    div className: cx('preview', 'is-cover': isCover), style: style

  renderExtension: ->
    fileType = @state.data.get 'fileType'

    div className: 'extension',
      i className: 'ti ti-file-holder'
      span {}, fileType

  render: ->
    cxView = cx 'file-view', 'is-clickable': @isFileClickable()

    onFileClick = =>
      if @isFileClickable()
        @props.onImageClick()

    form className: cx('form-table', 'is-dashed': not @state.isUploaded), onSubmit: @onFormSubmit,
      if @state.isUploaded
        div className: cxView, onClick: onFileClick,
          if @state.data.get('fileCategory').length is 0

Response:
noscript()
          else if detect.isImageWithPreview(@state.data)
            @renderPreview()
          else
            @renderExtension()
          span className: 'btn-group',
            if not @props.readOnly
              a className: 'btn btn-delete', onClick: @handleFileDelete,
                Icon size: 18, name: 'trash'
            else noscript()

            # Disable file preview for a while.
            # if @props.displayMode isnt 'create'
              # a className: 'btn btn-view', onClick: @handleFileView,
                # Icon size: 18, name: 'search'
            # else noscript()
      else noscript()
      fieldset {},
        if not @state.isUploaded
          Uploader
            data: @state.data
            onComplete: @handleFileComplete
        else noscript()
        div className: 'form-row', hidden: not @state.isUploaded,
          input


Response:
type: 'text'
            value: @state.data.get('fileName') or ''
            onChange: @handleFileNameChange
            readOnly: @props.readOnly
            autoFocus: not @props.readOnly
            className: 'text-row font-large text-overflow'
            placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-filename'
        div className: 'form-row', hidden: not @state.isUploaded,
          Textarea
            value: @state.data.get('text') or ''
            onChange: @handleTextChange
            readOnly: @props.readOnly
            className: 'textarea-row font-normal'
            placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-desc'


Prompt:
type: 'text'
            value: @state.data.get('fileName') or ''
            onChange: @handleFileNameChange
            readOnly: @props.readOnly
            autoFocus: not @props.readOnly
            className: 'text-row font-large text-overflow'
            placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-filename'

Response:
div className: 'form-row', hidden: not @state.isUploaded,
          Textarea
            value: @state.data.get('text') or ''
            onChange: @handleTextChange
            readOnly: @props.readOnly
            className: 'textarea-row font-normal'
            placeholder: if not @props.readOnly then lang.getText 'placeholder-enter-desc'