var $ = require('zepto-browserify').$;

var name = '.COM API';

var baseUrl = 'https://public-api.wordpress.com/rest/';

function getRequestUrl(request) {
  var version = request.version || 'v1';
  return baseUrl + version + request.path;
}

function getDiscoveryUrl(version) {
  return baseUrl + version + '/help';
}

function parseEndpoints(data, version) {
  return data;
}

function loadVersions(callback) {
  // Strange having to specify a version to retrieve versions :)
  $.ajax({
    type: 'GET',
    url: baseUrl + 'v1.1/versions?include_dev=true',
    headers: $.extend({'accept':'application/json'}),
    success: function(data) {
      callback(undefined, data.versions.map(version => 'v' + version), 'v' + data.current_version);
    },
    error: function(xhr, errorType, error) {
      callback({
        status: xhr.status,
        error: error,
        errorType: errorType,
        body: xhr.response,
      });
    }
  });
}

module.exports = {
  name: name,
  baseUrl: baseUrl,
  getRequestUrl: getRequestUrl,
  getDiscoveryUrl: getDiscoveryUrl,
  parseEndpoints: parseEndpoints,
  loadVersions: loadVersions
};

var $ = require('zepto-browserify').$;

var name = '.COM API';

var baseUrl = 'https://public-api.wordpress.com/rest/';

function getRequestUrl(request) {
  var version = request.version || 'v1';
  return baseUrl + version + request.path;
}

function getDiscoveryUrl(version) {
  return baseUrl + version + '/help';
}

function parseEndpoints(data, version) {
  return data;
}

function loadVersions(callback) {
  // Strange having to specify a version to retrieve versions :)
  $.ajax({
    type: 'GET',
    url: baseUrl + 'v1.1/versions?include_dev=true',
    headers: $.extend({'accept':'application/json'}),
    success: function(data) {
      callback(
        undefined,
        data.versions.map(function(version) {
         return 'v' + version;
        }),
        'v' + data.current_version
      );
    },
    error: function(xhr, errorType, error) {
      callback({
        status: xhr.status,
        error: error,
        errorType: errorType,
        body: xhr.response,
      });
    }
  });
}

module.exports = {
  name: name,
  baseUrl: baseUrl,
  getRequestUrl: getRequestUrl,
  getDiscoveryUrl: getDiscoveryUrl,
  parseEndpoints: parseEndpoints,
  loadVersions: loadVersions
};

Remove arrow function to fix the build
Remove arrow function to fix the build

events.js:165
      throw err;
      ^

Error: Uncaught, unspecified "error" event. (SyntaxError: Unexpected
token: operator (>) while parsing file: [...]/lib/api/com.js
(line: 27, col: 53, pos: 695)

Error
    at new JS_Parse_Error (eval at <anonymous>
([...]/node_modules/uglify-js/tools/node .js:28:1), <anonymous>:1545:18)
