Skip to content

Commit

Permalink
Merge pull request #202 from Automattic/update/es6-export
Browse files Browse the repository at this point in the history
Use ES6 `export` keyword consistently
  • Loading branch information
retrofox authored and jsnajdr committed Jan 27, 2020
1 parent 5b15d60 commit dfbf601
Show file tree
Hide file tree
Showing 27 changed files with 27 additions and 154 deletions.
7 changes: 1 addition & 6 deletions packages/wpcom.js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const DEFAULT_ASYNC_TIMEOUT = 30000;
* @param {Function} [reqHandler] - function Request Handler
* @return {WPCOM} wpcom instance
*/
function WPCOM( token, reqHandler ) {
export default function WPCOM( token, reqHandler ) {
if ( ! ( this instanceof WPCOM ) ) {
return new WPCOM( token, reqHandler );
}
Expand Down Expand Up @@ -214,8 +214,3 @@ if ( ! Promise.prototype.timeout ) {
] );
};
}

/**
* Expose `WPCOM` module
*/
module.exports = WPCOM;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.connected-application.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const root = '/me/connected-applications/';

class MeConnectedApp {
export default class MeConnectedApp {

/**
* `MeConnectedApp` constructor.
Expand Down Expand Up @@ -40,8 +40,3 @@ class MeConnectedApp {
return this.wpcom.req.del( root + this._id + '/delete', query, fn );
}
}

/**
* Expose `MeConnectedApp` module
*/
module.exports = MeConnectedApp;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import MeTwoStep from './me.two-step';
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Me( wpcom ) {
export default function Me( wpcom ) {
if ( ! ( this instanceof Me ) ) {
return new Me( wpcom );
}
Expand Down Expand Up @@ -177,8 +177,3 @@ Me.prototype.twoStep = function() {
Me.prototype.keyringConnection = function( id ) {
return new MeKeyringConnection( id, this.wpcom );
};

/**
* Expose `Me` module
*/
module.exports = Me;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.keyring-connection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const root = '/me/keyring-connections/';

class KeyringConnection {
export default class KeyringConnection {

/**
* `KeyringConnection` constructor.
Expand Down Expand Up @@ -40,8 +40,3 @@ class KeyringConnection {
return this.wpcom.req.del( root + this._id + '/delete', query, fn );
}
}

/**
* Expose `KeyringConnection` module
*/
module.exports = KeyringConnection;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.publicize-connection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const root = '/me/publicize-connections/';

class PublicizeConnection {
export default class PublicizeConnection {
/**
* `PublicizeConnection` constructor.
*
Expand Down Expand Up @@ -63,8 +63,3 @@ class PublicizeConnection {
return this.wpcom.req.del( root + this._id + '/delete', query, fn );
}
}

/**
* Expose `PublicizeConnection` module
*/
module.exports = PublicizeConnection;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import MeSettingsPassword from './me.settings.password';
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function MeSettings( wpcom ) {
export default function MeSettings( wpcom ) {
if ( ! ( this instanceof MeSettings ) ) {
return new MeSettings( wpcom );
}
Expand Down Expand Up @@ -83,8 +83,3 @@ MeSettings.prototype.profileLinks = function() {
MeSettings.prototype.password = function() {
return new MeSettingsPassword( this.wpcom );
};

/**
* Expose `MeSettings` module
*/
module.exports = MeSettings;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.settings.password.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const root = '/me/settings/password/';

class MeSettingsPassword {
export default class MeSettingsPassword {

/**
* `MeSettingsPassword` constructor.
Expand All @@ -27,8 +27,3 @@ class MeSettingsPassword {
return this.wpcom.req.post( root + 'validate', query, { password: password }, fn );
}
}

/**
* Expose `MeSettingsPassword` module
*/
module.exports = MeSettingsPassword;
8 changes: 1 addition & 7 deletions packages/wpcom.js/lib/me.settings.profile-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const root = '/me/settings/profile-links';
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function ProfileLinks( wpcom ) {
export default function ProfileLinks( wpcom ) {
if ( ! ( this instanceof ProfileLinks ) ) {
return new ProfileLinks( wpcom );
}
Expand Down Expand Up @@ -106,9 +106,3 @@ ProfileLinks.prototype.del = function( slug, query, fn ) {

// Create `delete` alias
ProfileLinks.prototype.delete = ProfileLinks.prototype.del;

/**
* Expose `ProfileLinks` module
*/

module.exports = ProfileLinks;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.two-step.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MeTwoStepSMS from './me.two-step.sms';

const root = '/me/two-step/';

class MeTwoStep {
export default class MeTwoStep {

/**
* `MeTwoStep` constructor.
Expand Down Expand Up @@ -40,8 +40,3 @@ class MeTwoStep {
return new MeTwoStepSMS( this.wpcom );
};
}

/**
* Expose `MeTwoStep` module
*/
module.exports = MeTwoStep;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/me.two-step.sms.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const root = '/me/two-step/sms/';

class MeTwoStepSMS {
export default class MeTwoStepSMS {

/**
* `MeTwoStepSMS` constructor.
Expand All @@ -26,8 +26,3 @@ class MeTwoStepSMS {
return this.wpcom.req.post( root + 'new', query, fn );
}
}

/**
* Expose `MeTwoStepSMS` module
*/
module.exports = MeTwoStepSMS;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.category.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Category( slug, sid, wpcom ) {
export default function Category( slug, sid, wpcom ) {
if ( ! sid ) {
throw new Error( '`site id` is not correctly defined' );
}
Expand Down Expand Up @@ -78,8 +78,3 @@ Category.prototype.delete = Category.prototype.del = function( query, fn ) {
var path = '/sites/' + this._sid + '/categories/slug:' + this._slug + '/delete';
return this.wpcom.req.del( path, query, fn );
};

/**
* Expose `Category` module
*/
module.exports = Category;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var commentLike = require( './site.comment.like' );
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Comment( cid, pid, sid, wpcom ) {
export default function Comment( cid, pid, sid, wpcom ) {
if ( ! sid ) {
throw new Error( '`site id` is not correctly defined' );
}
Expand Down Expand Up @@ -152,8 +152,3 @@ Comment.prototype.likesList = function( query, fn ) {
var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes';
return this.wpcom.req.get( path, query, fn );
};

/**
* Expose `Comment` module
*/
module.exports = Comment;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.comment.like.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function CommentLike( cid, sid, wpcom ) {
export default function CommentLike( cid, sid, wpcom ) {
if ( ! sid ) {
throw new Error( '`site id` is not correctly defined' );
}
Expand Down Expand Up @@ -61,8 +61,3 @@ CommentLike.prototype.delete = function( query, fn ) {
var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine/delete';
return this.wpcom.req.del( path, query, fn );
};

/**
* Expose `CommentLike` module
*/
module.exports = CommentLike;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.follow.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Follow( site_id, wpcom ) {
export default function Follow( site_id, wpcom ) {
if ( ! site_id ) {
throw new Error( '`site id` is not correctly defined' );
}
Expand Down Expand Up @@ -57,8 +57,3 @@ Follow.prototype.del = function( query, fn ) {
var path = '/sites/' + this._sid + '/follows/mine/delete';
return this.wpcom.req.del( path, query, null, fn );
};

/**
* Expose `Follow` module
*/
module.exports = Follow;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.media.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ var debug = require( 'debug' )( 'wpcom:media' );
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Media( id, sid, wpcom ) {
export default function Media( id, sid, wpcom ) {
if ( ! ( this instanceof Media ) ) {
return new Media( id, sid, wpcom );
}
Expand Down Expand Up @@ -175,8 +175,3 @@ Media.prototype.delete = Media.prototype.del = function( query, fn ) {
var path = '/sites/' + this._sid + '/media/' + this._id + '/delete';
return this.wpcom.req.del( path, query, fn );
};

/**
* Expose `Media` module
*/
module.exports = Media;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.post.like.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Like( pid, sid, wpcom ) {
export default function Like( pid, sid, wpcom ) {
if ( ! sid ) {
throw new Error( '`site id` is not correctly defined' );
}
Expand Down Expand Up @@ -59,8 +59,3 @@ Like.prototype.delete = function( query, fn ) {
var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine/delete';
return this.wpcom.req.del( path, query, fn );
};

/**
* Expose `Like` module
*/
module.exports = Like;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.post.reblog.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Reblog( pid, sid, wpcom ) {
export default function Reblog( pid, sid, wpcom ) {
if ( ! sid ) {
throw new Error( '`site id` is not correctly defined' );
}
Expand Down Expand Up @@ -81,8 +81,3 @@ Reblog.prototype.to = function( dest, note, fn ) {

return this.add( { note: note, destination_site_id: dest }, fn );
};

/**
* Expose `Reblog` module
*/
module.exports = Reblog;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function Tag( slug, sid, wpcom ) {
export default function Tag( slug, sid, wpcom ) {
if ( ! sid ) {
throw new Error( '`site id` is not correctly defined' );
}
Expand Down Expand Up @@ -78,8 +78,3 @@ Tag.prototype.delete = Tag.prototype.del = function( query, fn ) {
var path = '/sites/' + this._sid + '/tags/slug:' + this._slug + '/delete';
return this.wpcom.req.del( path, query, fn );
};

/**
* Expose `Tag` module
*/
module.exports = Tag;
8 changes: 1 addition & 7 deletions packages/wpcom.js/lib/site.wordads.earnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function SiteWordAdsEarnings( sid, wpcom ) {
export default function SiteWordAdsEarnings( sid, wpcom ) {
if ( ! ( this instanceof SiteWordAdsEarnings ) ) {
return new SiteWordAdsEarnings( sid, wpcom );
}
Expand Down Expand Up @@ -48,9 +48,3 @@ function SiteWordAdsEarnings( sid, wpcom ) {
SiteWordAdsEarnings.prototype.get = function( query, fn ) {
return this.wpcom.req.get( '/sites/' + this._sid + '/wordads/earnings', query, fn );
};

/**
* Expose `SiteWordAdsEarnings` module
*/

module.exports = SiteWordAdsEarnings;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.wordads.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import SiteWordAdsTOS from './site.wordads.tos';
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function SiteWordAds( sid, wpcom ) {
export default function SiteWordAds( sid, wpcom ) {
if ( ! ( this instanceof SiteWordAds ) ) {
return new SiteWordAds( sid, wpcom );
}
Expand Down Expand Up @@ -87,8 +87,3 @@ SiteWordAds.prototype.earnings = function() {
SiteWordAds.prototype.tos = function() {
return new SiteWordAdsTOS( this._sid, this.wpcom );
};

/**
* Expose `SiteWordAds` module
*/
module.exports = SiteWordAds;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.wordads.settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function SiteWordAdsSettings( sid, wpcom ) {
export default function SiteWordAdsSettings( sid, wpcom ) {
if ( ! ( this instanceof SiteWordAdsSettings ) ) {
return new SiteWordAdsSettings( sid, wpcom );
}
Expand Down Expand Up @@ -73,8 +73,3 @@ SiteWordAdsSettings.prototype.update = function( query, body, fn ) {
var path = '/sites/' + this._sid + '/wordads/settings';
return this.wpcom.req.post( path, query, body, fn );
};

/**
* Expose `SiteWordAdsSettings` module
*/
module.exports = SiteWordAdsSettings;
7 changes: 1 addition & 6 deletions packages/wpcom.js/lib/site.wordads.tos.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @param {WPCOM} wpcom - wpcom instance
* @return {Null} null
*/
function SiteWordAdsTOS( sid, wpcom ) {
export default function SiteWordAdsTOS( sid, wpcom ) {
if ( ! ( this instanceof SiteWordAdsTOS ) ) {
return new SiteWordAdsTOS( sid, wpcom );
}
Expand Down Expand Up @@ -92,8 +92,3 @@ SiteWordAdsTOS.prototype.sign = function( query, fn ) {
var path = '/sites/' + this._sid + '/wordads/tos';
return this.wpcom.req.post( path, query, { tos: 'signed' }, fn );
};

/**
* Expose `SiteWordAdsTOS` module
*/
module.exports = SiteWordAdsTOS;
Loading

0 comments on commit dfbf601

Please sign in to comment.